I know that traditionally you can have 2 main pages: the static page (front-page.php
)and the page for the last posts(home.php
).
Right now, front-page.php (Home) is my “index” page. It has some content (like a tagline), but now I want my last post to be displayed bellow that content.
Like this (front-page.php):
<?php
/*
Template Name: Front Page
*/
get_header(); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?> <--this is the tagline of my main page
<div class="line2"></div>
<?php endwhile; ?>
<<<<<<MY LAST POST HERE>>>>>>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Use
get_posts()
and do a basic loop to output the title, content or whatever you like, it will work just like a regular loop, for example..Reference for functions used in the above.
http://codex.wordpress.org/Template_Tags/get_posts
http://codex.wordpress.org/Function_Reference/wp_reset_query
Hope that helps.. 🙂