WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Wordpress blog hosted on a shared web server: http://martinnormark.com

I would like to add a whole new "area" to this site, called Consulting. When navigating to http://martinnormark.com/consulting - another template with different navigation should be used, and the frontpage should be blog posts for that specific area.

This also means, that the blog posts I write for the Consulting area should not be displayed on the front page of the root domain.

I use the Genesis framework, but I think that might be my problem. It doesn't seem to support this setup.

Any suggestions for frameworks, themes, or plugins?


function exclude_category( $query ) {
    if ( !$query->is_category('hardware')) {
        $query->set( 'cat', '-1' );
add_action( 'pre_get_posts', 'exclude_category' );
share|improve this question
So the "hardware" cat has an id of 1? It looks like "Uncategorized" is id 1 (martinnormark.com/?cat=1) looks like hardware has an id of 30 (martinnormark.com/?cat=30) so the code should be $query->set( 'cat', '-30' ); – BandonRandon Oct 27 '11 at 19:17
Boooom! It works, it's just me that didn't fully understand the code. Thanks! – MartinHN Oct 27 '11 at 21:15
up vote 2 down vote accepted

The framework is not the problem. You just need to exclude your Consulting category from the loop each time you have it. Then use a custom template for the marketing page. Another option would be to set up a multi-site install and then use Consulting as its own blog.


To exclude the category try adding this to your themes function.php

function exclude_category( $query ) {
    if ( !$query->is_category('consulting')) {
        $query->set( 'cat', '-1' );
add_action( 'pre_get_posts', 'exclude_category' );

Edit 2: fixing the problem chip mentioned below.

share|improve this answer
Excluding the posts from the consulting category doesn't seem to work. I add its ID to the exclusion list in Genesis settings, but it doesn't exclude the posts... Any idea? – MartinHN Oct 23 '11 at 20:27
I'm not sure how Genisis does it but see edit. – BandonRandon Oct 24 '11 at 6:35
Don't you want to use is_category( 'consulting' ) instead of is_page( 'consulting' ), so that the conditional is testing for the consulting category archive page, rather than for a static page named "Consulting"? – Chip Bennett Oct 24 '11 at 13:14
@ChipBennett You're right my bad. – BandonRandon Oct 24 '11 at 16:11
I can't get that working. Right now there's one post in the Hardware category on my blog: martinnormark.com and I have added your (updated) code to the bottom of the functions.php and chenged 'consulting' to 'hardware' - but the Hardware post is still present on the front page. Any idea? The post on the front page is "The (almost) Ultimate Developer PC 2.0", a little below the middle of the page. – MartinHN Oct 26 '11 at 17:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.