WordPress.org

Forums

how to open home page with most recent post only? (5 posts)

  1. whitelight
    Member
    Posted 3 years ago #

    Hi WordPress team,

    When I type in my domain name "www.musicarrangerspage.com" I would like it to start (on my home page) with only the most recent post (instead of a summary of all the articles). How can I change this? Is it also possible to put my socialize buttons on that first page? And lastly start with an open comment box at the bottom, instead of that users have to click first on the comments link to open the comment box.

    Thanks for your help in advance,
    Hans

  2. threestyler
    Member
    Posted 3 years ago #

    There is literally 101 ways you could approach this.

    The simplest explainable method I can think of would be:

    - Create a copy of your index.php and rename it home.php then open home.php. Look for something at the start of the 'loop' that resembles:
    <?php while (have_posts()) : the_post(); ?>

    Replace with:
    <?php $i = 0; while (have_posts() && $i < 1) : the_post(); ?>

    Then find:
    <?php endwhile; ?>

    Replace with:
    <?php $i++; endwhile; ?>

    Save and close. If you want to increase the number of posts then change && $i < 1) to reflect the # of posts to display.

  3. whitelight
    Member
    Posted 3 years ago #

    Hi threestyler,

    Thanks for your response. I'm a newbie in the world of .php.
    Where can I locate the index php? Somewhere in the adnim area?
    Or do I have to go the cpanel of hostgator (my host)?
    Do you think I should buy a book about html and php to have a
    better understanding? Or is there knowledge base in this forum?

    Thanks for your help in advance,
    Hans

  4. threestyler
    Member
    Posted 3 years ago #

    The index.php is part of what makes up the theme your using. Generally it would be accessed via FTP. But could also be found via a File Editor in your hosts control panel or within the Appearance > Themes > Editor settings of the wp-admin. But what I suggested may be overkill for your needs right now.

    If all you wish to do is display one post then go to the wp-admin panel:
    Settings > reading > Blog pages show at most

    Change to 1. This will show only one post per page. Should you wan't a bit more control over showing n number of posts on different pages in the future then my first suggestion would be worth following.

    The first place to start with learning more about WordPress is within the codex:
    http://codex.wordpress.org/Main_Page

  5. whitelight
    Member
    Posted 3 years ago #

    Hi freestyler,

    Thanks for your feedback. It did help.

    With friendly greetings,
    Hans

Topic Closed

This topic has been closed to new replies.

About this Topic