ThemeShaper Forums » Thematic

[closed]

Exclude Category from loop AND the widgets!

(8 posts)
  • Started 3 years ago by circleatseven
  • Latest reply from logostar
  • This topic is not resolved
  1. Hello. I've seen a bunch of posts that explain how to exclude a specific category from the loop — and they all seem to work well, however, none of them ALSO exclude that category from the 'categories', 'archives', and 'recent posts' widgets!

    Here's the overview of what I am trying to do: I am using the 'Featured image' from posts of a certain category to display in a nivo slider on the home page(static page, not the blog) ... I want to hide the posts categorized as 'featured' (category '1') from everywhere except the home page.

    Anyone know how to do this?! Thanks!

    Posted 3 years ago #

  2. Posted 3 years ago #
  3. that's not really a thematic question. i think you'd need to write your own widgets

    Posted 3 years ago #
  4. that's not really a thematic question. i think you'd need to write your own widgets

    Posted 3 years ago #
  5. Actually, it is because I am neckdeep in a Thematic child theme build and Thematic doesn't easily let me edit the loop to exclude a category from the templates I need to exclude it from — all I can see are these action hooks! How do I edit those to exclude a category?!

    Posted 3 years ago #
  6. logostar
    Member

    I think you would have to use
    if ( is_home() ) {
    something like that.

    As I'm trying to exclude specific categories from the blog page.

    Posted 3 years ago #
  7. unfortunately, even though you are using Thematic, it is still a widget problem for removing that category from the widgets.

    to remove it from it from the index loop you'd do something like

    function kia_adjust_query(){
      global $wp_query;
      $defaults = $wp_query->query_vars;
      $new = array('category__not_in' => array( 6 ) ); //where 6 is the ID of the cat you'd like to exclude
      $args = wp_parse_args( $new, $defaults );
      query_posts($args);
    }
    add_action('thematic_aboveindexloop','kia_adjust_query');
    Posted 3 years ago #
  8. logostar
    Member

    Code above does not work,
    I actually googled exclude category from indexloop and came to a post on here with the correct code.
    Thanks for the help though! I always seem to find the answer on here using google.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.