Display current post on homepage (9 posts)

  1. berryonline
    Posted 10 years ago #

    I trying to get the most recent post to display on my homepage. Only the most recent post, in plain letters with no sidebars or anything like that.

    Can anyone help me.


  2. nearlythere
    Posted 10 years ago #

    if you JUST want it on your homepage, you can create a home.php template, and simple simple code, using query_posts to limit the display to one entry.

    try this in a new file named home.php, and upload to your themes folder.

    <?php get_header(); ?>

    <?php query_posts('showposts=1'); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    <small><?php the_time('F jS, Y') ?> </small>

    <?php the_content('Read the rest of this entry &raquo;'); ?>

    <?php endwhile; ?>

    <?php else : ?>

    <?php endif; ?>

    `<?php get_footer(); ?>

    more perams for query_posts: http://codex.wordpress.org/Template_Tags/query_posts

    i also found this on the codex, which offers another solution. so that you can eliminate the header. check this out:


    try both!

  3. berryonline
    Posted 10 years ago #

    I tried creating the home.php file, put it in the themes folder. Now what???

    Tried the first link you gave me couldnt get that to work. Iam really inexperianced with .php.

    I really appreciate your help.

  4. moshu
    Posted 10 years ago #

    You need to give us more info - and, eventually, a link to your site.
    Is the "homepage" part of the WP? the solution suggested above is for that case.
    Is the homepage at the root? In another directory? Is it a php file or html? Will there be anything else on the homepage or only the most recent post?
    Help us to help you :)

  5. berryonline
    Posted 10 years ago #

    Here is a link to my church's site which i run. Iam currently working on changing the theme.


    I've put a little message "Put WORD PRess here"
    Were i want the posts to appear.

    Sorry i wasnt more clear on what i wanted.


  6. moshu
    Posted 10 years ago #

    If the main page of your site is going to be an .html file, then you should probably look for a feedreader (e.g. from this CG Powerpack http://www.chait.net/index.php?p=238). I guess it works on HTML pages, too.

  7. berryonline
    Posted 10 years ago #

    Well i could change the extenstion woundnt matter. I just need to make it work.

    What would i have to change it to??

  8. moshu
    Posted 10 years ago #

    In .php pages it works for sure!
    However, if you can change it to .php then you have more choices:
    a. you can just include The_Loop in your homepage
    b. you can use this tutorial: http://www.transycan.net/blogtest/2005/07/05/integrate/
    c. you can use a recent_post plugin
    For all the cases see the tutorial how to make your .php file "WP aware".

    (noroc şi sănătate)

  9. berryonline
    Posted 10 years ago #

    I dont understand half of what those tutorials are saying, i thought there be a lot simplier way to do this???

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.