Jump to content


Photo
- - - - -

Filtering categories on homepage


  • Please log in to reply
7 replies to this topic

#1 tuanma

tuanma

    Advanced Member

  • Members
  • 83 posts

Posted 18 April 2012 - 06:07 AM

Hello,

I am trying to filter out categories on the homepage with the following action:

Please Login or Register to see this Hidden Content


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 Danny

Danny

    Is Awesome!

  • Moderators
  • 17533 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 18 April 2012 - 08:08 AM

Hi Tuan, Is this supposed to be an Action or a Filter ?

#3 tuanma

tuanma

    Advanced Member

  • Members
  • 83 posts

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 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

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:

Please Login or Register to see this Hidden Content


Please Login or Register to see this Hidden Content


Please Login or Register to see this Hidden Content



#5 tuanma

tuanma

    Advanced Member

  • Members
  • 83 posts

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 Danny

Danny

    Is Awesome!

  • Moderators
  • 17533 posts
  • LocationManchester, UK
  • Country: Country Flag

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.

Please Login or Register to see this Hidden Content



#7 anthalis

anthalis

    Advanced Member

  • Members

  • 60 posts
  • Framework Version:Dev. Latest. Always.
  • Country: Country Flag

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):

Please Login or Register to see this Hidden Content


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 Danny

Danny

    Is Awesome!

  • Moderators
  • 17533 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 24 April 2012 - 12:17 PM

@Anthalis, Thanks for sharing, Let us know @tuanma if this resolves your issue.