Forums

[resolved] Creating a new homepage with just the 3 newest blog posts (3 posts)

  1. mattyoungmark
    Member
    Posted 3 years ago #

    I'd like to have my blog on a separate pare, and have the home page simply display the three most recent posts (along with my usual header, sidebar and whatnot).

    I've set up a new page with a new page template, set it as a static homepage, and pasted in some code I found to display the posts. Now I'm having a devil of a time trying to paste in the style tags so the blog headers and content will display the same way as they do on the blog page! I also need to remove the page title, since it's styled the same way as my blog headers and will look weird.

    Is there an easier way to accomplish this? Or, can someone help me figure out how to correctly insert my style tags?

    My page, in half-styles disarray, is here: http://www.blogosaur.com/

    And the page template code looks like this:

    <?php /* Template Name: New Super Home
    */ ?>
    
    <?php get_header(); ?>
    <div class="content-bg">
        	<div class="main">
            	<div class="content-shadow">
            	<div class="column-one">
                <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
                	<div class="blog-head">
                    	<div class="blog-date"><?php the_time('d M Y') ?></div>
                        <div class="blog-header"><h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2></div>
                        <div class="comment-icon"><?php comments_popup_link(0, 1, '%', '', ''); ?></div>
                    </div>
                    <div class="blog-main">
                    	<div class="blog-content">
    
                        	<?php the_content('(Continue Reading)'); ?>
                            <p class="date"><?php the_time('M dS') ?> by <?php the_author(); ?></p>
                            <p class="link"><a href="<?php the_permalink() ?>">Continue Reading</a></p>
    
    <?php
    $postslist = get_posts('numberposts=3&amp;order=DESC&amp;orderby=post_date');
    foreach ($postslist as $post) :
    setup_postdata($post);
    ?>
    <li>
    
    <a href="<?php the_permalink(); ?>">  </a> <p class="blog-head">  <?php the_title(); ?></p> <pclass="blog-content"<?php the_content(); ?></p> 
    
    <p class="date"><?php the_time('M dS') ?> by <?php the_author(); ?></p> 
    
    </li>
    <?php endforeach; ?>
    
     </div>
                    </div>
                   <?php endwhile; ?>
    
    <?php else : ?>
    <div class="blog-main">
    <h2 class="not-found">Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>
    </div>
    <?php endif; ?>
    
     <div class="paging-main">
                    	<div class="page-count">Page 1 of 38</div>
                        <div class="page-list">
                        	<ul class="paging">
                            	<li><a href="#">1</a></li>
                                <li><a href="#">2</a></li>
                                <li><a href="#">3</a></li>
                                <li>.</li>
                                <li>.</li>
                                <li>.</li>
                                <li><a href="#">Last</a></li>
                            </ul>
                        </div>
                    </div>
    
                </div>
                <div class="column-two">
                	<?php get_sidebar(); ?>
                </div>
                </div>
            </div>
        </div>
    
    <?php get_footer(); ?>
  2. mattyoungmark
    Member
    Posted 3 years ago #

    Alternately, if someone could help me figure out how to set my homepage so that it just shows blog posts with a certain tag, I can use that to sort which posts will take priority. Any help is appreciated!

  3. mattyoungmark
    Member
    Posted 3 years ago #

    I found a solution here:

    http://www.corvidworks.com/articles/wordpress-content-on-other-pages

    My front page is still a little off, but it's mostly doing what I need it to!

Topic Closed

This topic has been closed to new replies.

About this Topic