WordPress.org

Ready to get started?Download WordPress

Forums

Making Recent post/ Single post as homepage (2 posts)

  1. bunteezone
    Member
    Posted 4 years ago #

    hi all,

    Please help me, i am quite new in wordpress. i have installed a christmas theme and I do not want the index.php file to my homepage. I want single post to me by homepage.

    it mean every time I add a new post it should become the homepage..

    Hints : my idea is to create a index.php file which will check the latest article and redirect to that page.

    can anyone help me coding it?

    thanks in advance
    merry christmas

  2. gerbilk
    Member
    Posted 4 years ago #

    you can set a page as the home page in settings, reading. to show a single post create a custom page template (google how to do this) and use the code below

    <?php query_posts('posts_per_page=1'); ?>
    
      <?php while (have_posts()) : the_post(); ?>
        <!-- Do special_cat stuff... -->
    
    <?php the_post() ?>
    <h2 class="entry-title"><?php the_title() ?></h2>
    				<div class="entry-content">
    <?php the_content() ?>
    
      <?php endwhile;?>

Topic Closed

This topic has been closed to new replies.

About this Topic