Support » Fixing WordPress » single post on homepage- what’s wrong with this code?

  • Resolved j0llyr0ger


    At one point I hade my index.php configured to show only one post. Now, after tinkering with it two posts are showing and I cannot figure out what is wrong.

    I have tried searching here but didn’t find what I wanted. I have read the loop and query_posts pages on the codex, but I must be missing something because this isn’t working right.

    Can somebody spot my error for me, please?

    Here’s the code of my index.php

    <?php get_header();?>
    <div id="main">
    <?php query_posts('showposts=1');?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2 class="title">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <h3 class="date"><?php the_time('F jS, Y') ?></h3>
    <!--<h4 class="timestamp">7:35 pm</h4>-->
    <?php the_content(); ?>
    <h5 class="postmeta"><span class="tags"></span><span class="comments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span></h5>
    <!--<?php trackback_rdf(); ?>-->
    <?php endwhile; ?>

    <?php else : ?>
    <?php echo "something's gone wrong...";?>
    <?php endif; ?>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • j0llyr0ger


    I think this must have been caused by using a / in the title of a post. It seems that the only post that causes the one just before it to also show has the slash character in its title.

    Maybe it’s a bug, who knows?

    I just added another post and it shows on the front page by itself so I am satisfied.




    is there any update here – I also want to display just the articles that i’ve just posted…

    here’s the example display only the latest articles in their blog does anybody knows how to do it?

    thanks in advance for your help appreciate it…



    ooppss just to clarify I know the dashboard can do it but what I mean is if I type 1 it works but the problem is if you add those external links and the recent articles when you click the continue reading you can still see them below the comments tab or in the upper part of the comments… What I want to do is to eliminate those external links when I click the continuation…

    Tanks again

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘single post on homepage- what’s wrong with this code?’ is closed to new replies.