Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   Restrict posts on index to a specific category. (http://forum.bytesforall.com/showthread.php?t=5925)

amish_geek Feb 17, 2010 03:37 PM

Restrict posts on index to a specific category.
 
Is it possible to only have the posts on the index page be from a single category (ie 'News') while posts in other categories are reached through the category navigation?

paulae Feb 17, 2010 04:08 PM

You can do this with PHP. Flynn helped me out when I wanted to show posts from all categories on the front page EXCEPT from 2 categories, Obituaries and Letters to the Editors. I wanted them to show only in the left sidebar as separate "Recently In....." widgets.

I put this in the Style and Edit Center Column/Content Above the Loop section:
Code:

<?php if (is_front_page() && !is_paged() )
    $posts = query_posts($query_string . '&cat=-15,-80'); ?>

The -15 and -80 means "don't show posts from these categories". The clunky way to do what you want would be to put all of your categories EXCEPT the one you do want in there with the minus sign. The elegant way would be with the proper PHP code.

lmilesw Feb 17, 2010 04:13 PM

Another possibility is to use the Sticky Front Page Categories and Tags plugin or the Opt-in Front Page plugin which allows the blog or news category to show as you wanted.


All times are GMT -6. The time now is 05:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.