Flare
Flare

Reputation: 11

How to show the latest post (one only) on the homepage with full text, comments and all?

On Wordpress, how can I show the latest post (one only) on the homepage with full text, comments and all?

I basically would like the homepage to be the latest post as if I clicked it and got the post url (like: domain/wordpress/?p=18 for example).

Upvotes: 0

Views: 6572

Answers (3)

Flare
Flare

Reputation: 11

Thanks guys for the reply. I did what you've suggested TheLibzter :-) windyjonas, your answer was partial right. What eventually did the trick is:

<?php query_posts(); ?>
 <?php while (have_posts()) : the_post(); ?>
  <div class="post" id="post-<?php the_ID(); ?>">
   <h2>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
      <?php the_title(); ?>
     </a>
   </h2>
   <div class="entry"><?php the_content(); ?></div>
  </div>
<?php endwhile; ?>
<?php
  global $withcomments; $withcomments = true;
  comments_template( '', true );
?>

Upvotes: 1

TheLibzter
TheLibzter

Reputation: 777

Here's what I would do:

  • In your WordPress admin panel, under Settings in the sidebar, click Reading.
  • Make sure the top radio button under Front Page Displays ("Your latest posts") is selected.
  • Now change the number in the box next to "Blog pages show at most" to 1.
  • Now, make sure that the "Full text" radio button next to "For each article in a feed, show" is selected.

That should do the trick, but let me know if it doesn't work for you. :)

Upvotes: 1

windyjonas
windyjonas

Reputation: 2322

Redirect from home.php:

if (have_posts()):
    while (have_posts()):
        the_post();
        wp_redirect(get_permalink());
    endwhile;
endif;

Upvotes: 0

Related Questions