Is it possible to do this in the WordPress?

aspe_heat

Senior Member
Oct 7, 2010
804
595
Probably only a WordPress expert can help me with this, so hopefully I'll find one here!

I created "main" categories, six of them. Each category has 5 sub-categories. However, I only use sub-categories and never categories. So when I go to www.mysite.com/main-category it opens all the posts written under sub-categories. What I am wondering is following : is it possible to make that link point to a WordPress page or a post? So when I go to it, I would be redirected to a page/post instead of getting list of all the posts under sub-categories.

I tried creating a page and setting its permalink to main-category, but it didn't work.

Thanks for the help!
 
You wouldn't actually create a new page, you would create a new category page file.

Normally when you create a custom page it would be like "page-aboutus.php", but in this case you would use the category. So it would be like "category-aboutus.php"

You can read more about the category hierarchy here: http://codex.wordpress.org/Category_Templates

If you aren't able to code up a new page, just copy the contents of page.php into new category page file. Or if you want to get the contents of that category on your custom category page, you could include this above your loop:

Using category ID
<?php query_posts("cat=203"); ?>

Using category name
<?php query_posts("category_name=aboutus"); ?>

You can read more about that here: http://codex.wordpress.org/Function_Reference/query_posts
 
The plugin works like a charm, thanks a lot!

Thanks to you also, makemecash, for the useful information you posted! I'll make sure I read it all so I can learn more.

Be aware that with the redirection plugin you are doing a 301 redirect. It would be better for you to skip the redirect and have a straight page.

However, if you must do a redirect then use the code below. Since WP is database heavy, the more plugins you use the more server resources you use and your page load time increases.

Simply create a custom category file "category-yourpagesname.php"
Then inside the file just include the following code:

<?php header( 'Location: http://www.yoursite.com/new_page' ) ; ?>
 
Be aware that with the redirection plugin you are doing a 301 redirect. It would be better for you to skip the redirect and have a straight page.

However, if you must do a redirect then use the code below. Since WP is database heavy, the more plugins you use the more server resources you use and your page load time increases.

Simply create a custom category file "category-yourpagesname.php"
Then inside the file just include the following code:

<?php header( 'Location: http://www.yoursite.com/new_page' ) ; ?>

Alright, thanks again!
Just one more question - why is it bad to have 301 redirect?
 
I've just found the way to do it without the plugin...I am just not sure if it's considered a 301 redirect again?

If my category page link is mysite.com/category-page, I would create a new page with the name "Category Page" so it would automatically create mysite.com/category-page permalink. Then I would have two different pages with the same link. However, I would then edit that page and change the permalink to mysite.com/category-page-real or something like that, and whenever someone would go on the category, she/he will land on the page I created.
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock