Jump to content
Sign in to follow this  
stenbeck

Exclude a category on homepage in Platformpro

Recommended Posts

stenbeck    0
stenbeck

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
Andrew    201
Andrew

you mean exclude from a widget? navigation?

Share this post


Link to post
Share on other sites
stenbeck    0
stenbeck

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
Andrew    201
Andrew

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
stenbeck    0
stenbeck

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
cmunns    16
cmunns

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
stenbeck    0
stenbeck

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
cmunns    16
cmunns

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
thelbc    0
thelbc

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
stenbeck    0
stenbeck

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
thelbc    0
thelbc

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×