I am using the Boldy theme from Site5 on a v3.1.2 site.
The way this theme works, is that there is a portfolio, (which I am using as a case studies gallery) that pulls in posts from a specific category you define under the themes settings (id=98)
This is fine if you also set the blog up as per the Boldy instructions, where all blog posts come under a category called blog, but this wasnn’t going to give me the slugs I wanted, so I adopted to use a static page called blog to show my posts on.
This all works fine, apart from the fact that the posts I create for my portfolio/case studies gallery (category = case studies) now appear in my blog as well.
Is there a way to hide posts within a specific category within the blog, but for it not to have the same affect in my case studies gallery?
–EDIT–
With some help from Wyck via the comments, made some progress.
Here is a txt version of my themes default index.php file.
If I insert the following onto Line 2:
<?php query_posts($query_string . '&cat=-98'); ?>
= This results in no posts being shown on my Downloads page, but all posts still appearing on my Blog page.
I need the vice versa of this. I am sure I am close, but perhaps I need to modify which line I put this on?
–EDIT x2–
Now using the download monitor for my downloads gallery. But using the portfolio for my case studies. So some of the links above have changed, but the problem is exactly the same.
5 Answers
You want the category 98 to be excluded only on the blog page, right? They should be accessible on the category page directly (your downloads page), correct?
Can you try this? Let me know if its not what you want, we can modify it to suit your needs. Right not it only excludes the category on where you show your blog posts.
add_action('pre_get_posts', 'block_cat_query' );
function block_cat_query() {
global $wp_query;
if( is_home() ) {
$wp_query->query_vars['cat'] = '-98';
}
}