Placing posts on page templates for homepage
I have read “blog-posts-on-static-front-page” and it’s development the next year (now two years ago) “static-front-page-with-the-latest-post”
but I’m afraid that it is still not clear to me exactly where to place the code provided. Someone asked the very same thing but the topic was close with this unanswered.
Here’s the background:
Here’s my situation:
I want posts on the front page with a short intro text above. Because I need different templates for the two languages of the site, I have to use a static page for the front page. I have looked at some ‘posts into page’. Maybe I’ve misunderstood their use but I don’t see a clear instruction for getting all the posts (they all seem to be filtering for certain categories or types) or they place posts in a ul li form with the formatting and styles that go along with that.
Here’s my current thoughts:
I have two templates : sidebar-left-page ; and sidebar-right-page . I got this from an article and it said that the names had to be exactly these.
I’m thinking that I need two more templates : home-sidebar-left-page ; and home-sidebar-right-page. That would solve the problem, but I need to
1) registering the new templates so that I can select themin the page editor
2) putting the right code in the right place of the loop of the new templates
The contet part of these template pages looks like this.
<div id=”content” role=”main”>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( ‘content’, ‘page’ ); ?>
<?php comments_template( ”, true ); ?>
<?php endwhile; // end of the loop. ?
</div><!– #content –>
The above forum topics, and the axcellent article on “the Loop” http://codex.wordpress.org/The_Loop have the loop beginning with if
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
Is that a change in recent WordPress versions?
I’d be grateful for an answer understandable to a novice coder, as I’m sure many readers in the future will be.
- The topic ‘Placing posts on page templates for homepage’ is closed to new replies.