Jump to content
Sign in to follow this  
heavenorshell

Show latest 3 posts of home category

Recommended Posts

heavenorshell

I use the blogpage as my homepage and I would like the homepage only to show the latest 3 posts from one single category (view link http://heavenorshell.se.preview.binero.se/). Just now I have added: add_action('pagelines_before_theloop', 'exclude_cat'); to exclude all other categories but I guess it must be an easier way to just show this specified category with the latest 3 posts.

Share this post


Link to post
Share on other sites
heavenorshell

I have tried replacing the exclude_cat hook with the following: ` add_action('pagelines_before_theloop', 'include_cat'); function include_cat(){ if (is_home()) { query_posts("cat=31;&showposts=3;"); } } ` with the intension to show only this specified category with the 3 latest posts, but it seems to give me an archive-look, see link (http://heavenorshell.se.preview.binero.se/) and I would like it to look as shown in this picture ( E8Fwl.png) Any ideas of where I did go wrong?

Share this post


Link to post
Share on other sites
heavenorshell

In functions.php in platformbase.

Share this post


Link to post
Share on other sites
Andrew

Hi Kristina, Could you just turn off 'Magazine Layout' Mode to get the posts looking that way? Also, you can hide certain things like the `Du tittar p?? kategori: "Senaste nytt"` with Custom CSS. Does that help?

Share this post


Link to post
Share on other sites
heavenorshell

Hi Andrew, Thank you for your answer, but I am sorry to say that turning off Magazine Layout did not solve the problem. It gave me three posts from the specified category but viewed them in their whole length, which I do not prefer. And the funny thing is that my hook still shows up as if I looked into a category page, which I did not intend it to be. And I do not want to hide that with custom CSS, as I like it to show up on category pages. But when I used this code:

add_action('pagelines_before_theloop', 'exclude_cat');
	function exclude_cat(){
		if (is_home()) {
			query_posts("cat=-5,-7,-1,-6,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-21,-22");
		}
	}	

it all worked out fine (as in this picture: E8Fwl.png) except that it was impossible to decide how many posts I wanted to show up. And that hook did not act as if I wanted to show a category page.

Share this post


Link to post
Share on other sites
cmunns

I would turn off magazine mode. Then when it is showing them in full-width make sure in your Blog and Posts Options you check the appropriate boxes for when/where to show full post v excerpts...if that does not work then we can modify the postloop a touch

Share this post


Link to post
Share on other sites
heavenorshell

Voila! The only bad thing with platformpro is that you have too many options to choose from... I thought I had tried all options in settings for blog and posts but apparently not. Now it is working, the only thing I have to get rid of is the statement about

 Du tittar p?? kategori: "Senaste nytt"

but I guess I can try some Custom CSS. Thank you so much!

Share this post


Link to post
Share on other sites
bryan-hadaway

`.home .current_posts_info{display:none}` Thanks, Bryan

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  

×