Excluding Categories from Blog Roll

This support request was posted in Paeon by JayWilly

Request ID #3634 Resolved
  • Hello NiceThemes!

    I’ve purchased and installed your theme and am almost done my site. One of the last things I need to do is exclude two categories of posts from displaying on the Blog page.

    Could you please provide me with the technical answer / snippet of code?

    Really looking forward to hearing from you soon!

    I’m almost there!

    Thanks

    Justin

    Juanfra Aldasoro

    Hi Justin,

    Thanks for writing.

    Unfortunately we can’t provide support on customization. However, I’ve posted something related to that in my personal blog a while ago: http://juanfra.me/2012/11/how-to-exclude-categories-from-your-wordpress-home-page/

    You should use that snippet and modify the is_home conditional

    Best,
    Juan

    Thanks for the quick reply. Do you offer your services for sale to customize?

    Looking at that snippet, it is a little outside my scope, as I don’t eally work with .php

    Trying to wrap my head around that conditional statement.

    Juanfra Aldasoro

    No problem.

    Unfortunately we don’t offer customization services. You can contact our friends at http://codeable.io

    Best,
    Juan.

    Aaaaand my site has a white out…

    #crappy

    Juanfra Aldasoro

    Hello Justin,

    Would you please describe me what is that you have done?

    Best,
    Juan.

    What I did was copy and paste this code.

    is_home() && $query->is_main_query() )
    $query->set( ‘cat’, ‘-1,-2,-3’ );

    return $query;
    }

    add_filter( ‘pre_get_posts’, ‘nice_exclude_cat’ );

    ?>

    and changed

    is_home -> is_blog

    ( ‘cat’, ‘-1,-2,-3’ ); -> ( ‘cat’, ‘6,7’ );

    That is all.

    Thank you for showing interest in my dilemma… 🙂

    Juanfra Aldasoro

    Hello Justin,

    First of all, you have erased the function definition. This is, where the function nice_exclude_cat is defined.

    Secondly, the function is_blog doesn’t exist. You should review your code and take into account that a simple comma or error in any piece of code can make your screen white.

    Best,
    Juan.

    My apologies.

    This was the code that I used.

    is_home() && $query->is_main_query() )
    $query->set( ‘cat’, ‘-1,-2,-3’ );

    return $query;
    }

    add_filter( ‘pre_get_posts’, ‘nice_exclude_cat’ );

    ?>

    ———-

    Anyway, I’ve handed it over to a .php dev – so it shall be fixed real soon.

    FTP file reset lol!

    Thanks Juan

    For some reason <?php is not appearing in the message reply.

    Juanfra Aldasoro

    Would you please send me your functions.php file to support@nicethemes.com?

    Best,
    Juan.

    Just sent it your way. Thanks Juan.

    BEST CUSTOMER SERVICE EVER!

    I’ll be a lifetime customer you bet!

    Thanks Support Team.

    Juanfra Aldasoro

    Thanks for your kind words, Justin.

    We’re happy to have you around 🙂

    Have a nice day,
    Juan.

Viewing 14 posts - 1 through 14 (of 14 total)

This topic is marked as resolved

Only the topic author can re-open this thread.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server