WordPress.org

Support

Support » Themes and Templates » one page view in front page

one page view in front page

Viewing 1 replies (of 1 total)
  • I’m not sure I understand your request, so I’ll make an assumption here. My assumption is that what you want to do is include a single recent post on a static page. So, in your page template the most efficient way to do that would probably be with a WP_Query object.

    I use this in a particular area on my site.

    <?php
      $recentBlog = new WP_Query();
      $recentBlog->query('showposts=1');
      if ($recentBlog->have_posts()) : while($recentBlog->have_posts()) : $recentBlog->the_post();
    ?>
         <h2><?php the_title(); ?></h2>
         <p><?php the_content_rss('&hellip;', 0, '', 50, 0); ?></p>
         <a href="<?php the_permalink('Find Out More&hellip;'); ?>">Read More&hellip;</a>
    <?php endwhile ?>
    <?php else : ?>
          <h2>Temporary Filler Box</h2>
          <p>This is temporary filler, because the content that's supposed to go here isn't here.</p>
          <p>How terribly lazy. Come back soon, and maybe there will be something.</p>
    <?php endif ?>

    That returns the single most recent post from the blog.

    Just include something like that on the page where you want the recent post to be displayed.

Viewing 1 replies (of 1 total)
  • The topic ‘one page view in front page’ is closed to new replies.
Skip to toolbar