Filtering categories on homepage
Started by
tuanma
, Apr 18 2012 06:07 AM
7 replies to this topic
#1
Posted 18 April 2012 - 06:07 AM
Hello,
I am trying to filter out categories on the homepage with the following action:
The code is placed in the base theme's functions.php file, but nothing happens.
Can someone have a look to see if the code is correct?
Thanks
Tuan
I am trying to filter out categories on the homepage with the following action:
The code is placed in the base theme's functions.php file, but nothing happens.
Can someone have a look to see if the code is correct?
Thanks
Tuan
#2
Posted 18 April 2012 - 08:08 AM
Hi Tuan,
Is this supposed to be an Action or a Filter ?
#3
Posted 18 April 2012 - 03:02 PM
Danny,
I'm not sure. I found this on the forum which says it was suppose to filter out specific categories on the homepage. However, it doesn't work.
Hoping the get some help with it.
Thank
#4
Posted 18 April 2012 - 04:08 PM
Did you get the code from PageLines Framework support or PlatformPro support. They each have their own hooks.
To check if "pagelines_inside_top_theloop" is the proper hook, activate the PageLines Action Map plugin on your site and look to see if the hook exists on the home page. (And according to one of the links below, it appears incorrect.)
Next, just guessing here but you probably want a filter, not an action, so you should change that.
Info for learning more about hooks:
To check if "pagelines_inside_top_theloop" is the proper hook, activate the PageLines Action Map plugin on your site and look to see if the hook exists on the home page. (And according to one of the links below, it appears incorrect.)
Next, just guessing here but you probably want a filter, not an action, so you should change that.
Info for learning more about hooks:
#5
Posted 18 April 2012 - 08:57 PM
Sorry, I'm more than green when it comes to php.
If I change the hook in the code above, do you think it will work then?
#6
Posted 19 April 2012 - 12:00 PM
Hi tuanma,
If coding isn't your thing, have you tried the Special Recent Post plug-in ? It allows you to use specific options to show only posts from category X and then provides you with a shortcode which you can then add to your Homepage content area.
I think using this plug-in would be the best course of action. I have provided you with a link to the plug-in below.
#7
Posted 23 April 2012 - 11:38 AM
HI Tuan,
This could solve your problem, if you are still looking for a piece of code to exclude categories. Replace the code you pasted in here with the following (in your child theme's functions.php):
Keep in mind that when using "is_home" you are referring to the blog page. If you have a static page set as Home in Setting>Reading you should replace "is_home" with "is_front_page". Of course, don't forget to replace "-1" with whatever category ID you want to exclude.
Good luck!
This could solve your problem, if you are still looking for a piece of code to exclude categories. Replace the code you pasted in here with the following (in your child theme's functions.php):
Keep in mind that when using "is_home" you are referring to the blog page. If you have a static page set as Home in Setting>Reading you should replace "is_home" with "is_front_page". Of course, don't forget to replace "-1" with whatever category ID you want to exclude.
Good luck!
#8
Posted 24 April 2012 - 12:17 PM
@Anthalis,
Thanks for sharing, Let us know @tuanma if this resolves your issue.












