Archived

This topic is now archived and is closed to further replies.

  • 0

Exclude a category on homepage in Platformpro

Question

Posted · Report post

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.

Share this post


Link to post
Share on other sites

10 answers to this question

Posted · Report post

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.

Share this post


Link to post
Share on other sites

Posted · Report post

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"); } } `

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites

Posted · Report post

you mean exclude from a widget? navigation?

Share this post


Link to post
Share on other sites

Posted · Report post

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.

Share this post


Link to post
Share on other sites

Posted · Report post

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_

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites

Posted · Report post

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.

Share this post


Link to post
Share on other sites