WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Single Post as front page - possible? (7 posts)

  1. hdodenhof
    Member
    Posted 6 years ago #

    Hi all,

    i'm searching for a plugin / hack that makes it possible to show only the latests post instead of the list of recent post on my front page. I know I could configure WordPress to show only one post, but I want to have the single-post-template with comments instead of the "overview"-template. So http://www.myblog.com should look exactly like http://www.myblog.com/2008/1/5/mynewestpost.
    As a quick'n'dirty solution I redirect the request via home.php to the latests post but this is not that nice and not very search-engine-friendly.

    Is there another way to do this? Many thanks in advance for any hint!

  2. Charles Frees-Melvin
    Member
    Posted 6 years ago #

    I your settings > reading > show at most: 1

  3. hdodenhof
    Member
    Posted 6 years ago #

    I know, but as i said:

    I know I could configure WordPress to show only one post, but I want to have the single-post-template with comments instead of the "overview"-template

  4. hdodenhof
    Member
    Posted 6 years ago #

    No way to make this possible?

  5. jrodgers
    Member
    Posted 6 years ago #

    create a template from one of the standard blog pages and set it to have only one post or use thisd as a starting place and configure as needed

    1)change events to something like home or firstpage etc

    2)where it says cat=11, change it to p=the id of the post you want to show,
    3)save it as someTemplate.php
    4)write/create a page and set the default template, option is on right hand side about half way down, to be the template name you gave it in step 1
    5)set your home page under options; select static page and point it to the page you created in step 4

    <?php
    /*
    Template Name: Events
    */
    ?>

    <?php get_header(); ?>

    <div id="content" class="narrowcolumn">
    <?php
    $query= 'cat=11'; // concatenate the query
    query_posts($query); // run the query
    $more = 0;
    ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php require('post.php'); ?>
    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
    <div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
    </div>

    <?php else : ?>

    <h2 class="center">Not Found</h2>
    <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  6. jrodgers
    Member
    Posted 6 years ago #

  7. hdodenhof
    Member
    Posted 6 years ago #

    Thank you very much - query_posts did the trick!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.