Jump to content
Sign in to follow this  
cgspnb

Need post excerpts on feature page

Recommended Posts

cgspnb

Greetings I need to display excerpts of the last 5 blog posts on a feature home page. I created a new page template based on the Feature page standard template. It is identical to the original except it includes a new template based on template_posts that includes a new file called posts_home.php based on the original posts.php http://michaelsantos.net/test/ However it is saying that there is nothing there. There are lots of posts however.The same code has no problems displaying the posts correctly at http://michaelsantos.net/test/?page_id=4389 I have tried using the default posts.php file but I am getting the same results on the home page. Is there some other function related to the home page that is nullifying

<?php if (!is_404() && have_posts()) : while (have_posts()) : the_post(); ?> 

Any assistance is appreciated!

Share this post


Link to post
Share on other sites
kastelic

This is pretty advanced stuff so I've marked it for the developers.

Share this post


Link to post
Share on other sites
Andrew

You can only use the `have_posts()` stuff on the posts page; WordPress controls when and where it can be used. In this case, you should use `get_posts` or a Query and loop through the responses with a `foreach`

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  

×