Welcome to the PageLines Forum. First check out the PageLines Docs to see if we have already answered your question. Before you post please read the forum guidelines.
Upcoming “PageLines Developer Essential Training”
Latest news regarding the developer training videos Click here!
Can you tell us more about the code you've used...Typically if you want to make this only affect certain pages such as the main blog then you would add conditionals e.g.
Well, specifically Ive put the query_posts( 'cat=-4' ); in the index.php of the theme and it works when the "Blog" page is accessed. But I have 2 issues:
1. In the widget (from _morefooter) where the latest posts are shown (mine is 3, just the titles) I still see the posts from the category that is supposed to be excluded.
2. When the "Blog" page is accessed in the summary of the posts the excluded category's posts are not visible, but when each individual post is accessed then the "prev" or "next" posts might be of the excluded category.
Hm, I know there's a way to exclude a category from a list of categories but not specific posts belonging to a category in a list of posts. There might be a solution for it somewhere on the web. I did some searching and found this: http://wordpress.org/support/topic/exclude-category-in-recent-posts-widget
Can you post a link to your site? I think I confused the "Recent Posts" widget with something else, but I'm pretty sure it's the widget that lists the post link titles...
Tim, I see maybe it makes sense just to implement my own code. I thought there was a way to do it through the widget, but yeah I've tried everything and the widget was still showing the excluded Category.
Now, I still see the post in the "Blog" singles pages. For instace lets say Im in a given category the "next" post might show a post from the excluded category. Do you guys know why ?
[quote]For instace lets say Im in a given category the "next" post might show a post from the excluded category. Do you guys know why ?[/quote]This involves messing with WP's previous_post_link() call.
Yes, I've actually find the code that exclude the post from excluded categories in the single post "prev" and "next" posts in wp-includes/link-template.php
/** * Display next post link that is adjacent to the current post. * * @since 1.5.0 * * @param string $format Optional. Link anchor format. * @param string $link Optional. Link permalink format. * @param bool $in_same_cat Optional. Whether link should be in same category. * @param string $excluded_categories Optional. Excluded categories IDs. */ function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '4') { adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false); }
It worked for me! So now I will just have to exclude the posts from excluded categories in the Recent Posts Widget. I think I will either use an excluder plugin or right my own.
Ok, found a plugin that exclude categories from pages and widgets "ACE". I guess this is it. I got everything that I need. Thanks alot guys for your help.