ThemeShaper Forums » Thematic

[closed]

Exclude categories from Posts Page

(3 posts)
  • Started 3 years ago by Pictrix
  • Latest reply from Pictrix
  • This topic is resolved
  1. Pictrix
    Member

    I'm am looking to:
    1) have posts of certain categories, Press & Events, appear ONLY in their own individual pages, and
    2) exclude them from being displayed in the “Posts Page” without using plugins.
    The Front Page is set up as a static page.

    For item 1), I set up a template that displays posts from a category that has the same name as the page. (See http://mygraphicfriend.wordpress.com/2010/01/20/wordpress-create-a-page-template-that-displays-posts-from-a-category-that-has-the-same-name-as-the-page/#comment-133).

    For item 2), I've tried different approaches discussed in this forum but I have not been able to implement them successfully, probably because the facts of the other topics were different than mine and because I'm very new to php.

    What code do I need to insert where? I'll greatly appreciate any suggestions!

    Posted 3 years ago #
  2. Put the following code into your functions.php file and modify the category ID.

    You can read more about query_posts() in the codex: http://codex.wordpress.org/Function_Reference/query_posts

    function childtheme_above_indexloop() {
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=-3&paged=$paged");
    }
    add_action('thematic_above_indexloop', 'childtheme_above_indexloop');

    Artur Kim

    Posted 3 years ago #
  3. Pictrix
    Member

    Your code worked perfectly, thanks so much!
    I appreciate the "read more" link too.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.