Excluding Categories from Blog Roll
This support request was posted in Paeon by JayWilly
- JayWilly March 11, 2014 at 10:54 pm
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 March 12, 2014 at 12:36 amHi 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,
JuanJayWilly March 12, 2014 at 12:53 amThanks 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 March 12, 2014 at 1:01 amNo problem.
Unfortunately we don’t offer customization services. You can contact our friends at http://codeable.io
Best,
Juan.Juanfra Aldasoro March 12, 2014 at 1:18 amHello Justin,
Would you please describe me what is that you have done?
Best,
Juan.JayWilly March 12, 2014 at 1:25 amWhat 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 March 12, 2014 at 1:29 amHello 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.JayWilly March 12, 2014 at 1:42 amMy 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
Juanfra Aldasoro March 12, 2014 at 1:45 amWould you please send me your functions.php file to support@nicethemes.com?
Best,
Juan.JayWilly March 12, 2014 at 5:28 pmBEST CUSTOMER SERVICE EVER!
I’ll be a lifetime customer you bet!
Thanks Support Team.
Juanfra Aldasoro March 12, 2014 at 6:14 pmThanks for your kind words, Justin.
We’re happy to have you around 🙂
Have a nice day,
Juan.
This topic is marked as resolved
Only the topic author can re-open this thread.