Jump to content


Photo

Exclude a category on homepage in Platformpro


This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1 stenbeck

stenbeck

    Member

  • Members
  • PipPip
  • 16 posts

Posted 19 October 2010 - 11:39 PM

I am trying to exclude a category from homepage. I just cant find the right place to fit the code (index.php like in the old days is kind of out of the picture nowdays) or a plugin that actually works with the theme. All help appreciated, thanks.

#2 arpowers

arpowers

    Founder

  • Administrators
  • 3254 posts

Posted 20 October 2010 - 01:21 AM

you mean exclude from a widget? navigation?

#3 stenbeck

stenbeck

    Member

  • Members
  • PipPip
  • 16 posts

Posted 20 October 2010 - 08:29 AM

I want to exclude posts from one category to appear on the homepage (the list of posts), so not menues, navigation or widgets, only from the stream of posts that appears on the homepage. I.e exclude posts from the catagory "food" from appearing on the main area on the homepage.

#4 arpowers

arpowers

    Founder

  • Administrators
  • 3254 posts

Posted 20 October 2010 - 05:57 PM

ah... this would be more of a general WP question. You can probably a plugin or two on the topic :)

#5 stenbeck

stenbeck

    Member

  • Members
  • PipPip
  • 16 posts

Posted 20 October 2010 - 06:08 PM

I am actually just trying to find out where I can insert the code. I cant find The Loop for some reason. The Index.php is not like in the old days :) Where can I find the loop and is it possible to do so it works when upgrading the platformpro (through platformbase maybe)?

#6 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts

Posted 20 October 2010 - 07:01 PM

You could do it in PlatformBase using a filter. Check the WP plugin/API for how to create a WP filter. I'm assuming you want to modify the_content()? and maybe a couple other functions.

#7 stenbeck

stenbeck

    Member

  • Members
  • PipPip
  • 16 posts

Posted 20 October 2010 - 09:48 PM

Sorry, to sound stupid here, but I still do not know where to insert the code and how to do it in Platformbase, cant find any documentation on the topic either. To be more specific I used to insert this snippet into index.php, but how do I do it with platformbase? <?php if (is_home()) { query_posts("cat=-3"); } ?> Thanks again.

#8 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts

Posted 20 October 2010 - 11:24 PM

Not a problem. I'm actually working on documentation right now for hooks. Here is what you would put in the functions.php file ` add_action('pagelines_before_theloop', 'exclude_cat'); function exclude_cat(){ if (is_home()) { query_posts("cat=-3"); } } `

#9 thelbc

thelbc

    Member

  • Members
  • PipPip
  • 13 posts

Posted 21 October 2010 - 07:42 AM

Useful! Like Fredrik Stenbeck, I'm not used to work with child theme... Now it makes sense. Thanks.

#10 stenbeck

stenbeck

    Member

  • Members
  • PipPip
  • 16 posts

Posted 21 October 2010 - 08:26 AM

Thanks a lot, now it works like a charm! You theme is getting better and better, like it a lot.

#11 thelbc

thelbc

    Member

  • Members
  • PipPip
  • 13 posts

Posted 22 October 2010 - 01:03 PM

Hi there,

I adapted the function above to this :

 
	add_action('pagelines_before_theloop', 'exclude_sticky');
	
		function exclude_sticky(){
			if (is_home()) {
	query_posts(array("post__not_in" =>get_option("sticky_posts")));
			}
	 	}

But now the pagination is not working anymore!

When I remove this action, everything is fine.

Any ideas on how I could fix that?

Jk_