WordPress.org

Ready to get started?Download WordPress

Forums

How to add latest post to bottom of static homepage? (4 posts)

  1. tom92373
    Member
    Posted 3 years ago #

    I created a static homepage for my WordPress site. Now, I want to put the latest/most recent blog post at the bottom of the homepage. I looked this up online and found one solution, but the problem is that it put the latest blog post on the bottom of every static page. Does anyone know how I can have the latest blog post show up at the bottom of just the homepage?

    I am using the Inove theme.

    Thanks,
    Tom

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    You could use the is_front_page() conditional:

    <?php if( is_front_page() ) :?>
    [ latest/most recent blog post code ]
    <?php endif;?>

    Or you could look at creating a custom page template for your front page.

  3. tom92373
    Member
    Posted 3 years ago #

    I tried adding that code to my page.php page, but it gave me an error. Here is the code that I tried:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  4. tom92373
    Member
    Posted 3 years ago #

    I wasn't adding the second '<?php endif;?>' to the end of the code. I added it and it works like a charm! Thanks esmi!

Topic Closed

This topic has been closed to new replies.

About this Topic