WordPress.org

Ready to get started?Download WordPress

Forums

Cant view/read post - have_posts() never return true? (1 post)

  1. holmes221
    Member
    Posted 6 years ago #

    Hi all,
    I am kinda frustrated with setting up WP now.
    It already happened to me yesterday. And I resolved by removing everything and start all over from scratch. I can't do this everytime I have this error....

    After some tweaking on themes (mostly on layout, etc.), installing some plugins, I can't view the post anymore.
    Any thing that I have messed up??
    Please advice me what to do.

    <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
            <div class="post" id="post-<?php the_ID(); ?>">
    		  <div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div>
    		  <div class="title">
              <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
              <div class="postdata"><span class="category"><?php the_category(', ') ?></span>  <span class="comments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span></div>
    		  </div>
              <div class="entry">
    			<?php if(is_category() || is_archive()) {
    			   //the_title();
    			} else {
    			  the_content('Continue Reading &raquo;');
    			} ?>
    
                <p class="submeta">written by <strong><?php the_author(); ?></strong>
    			<?php
    				if(function_exists("the_tags"))
    					the_tags('\\\\ tags: ', ', ', '<br />');
    			?>
                </p>
    
              </div><!--/entry -->
    
            </div><!--/post -->
    
    		<?php endwhile; ?>
    
            <div class="page-nav"> <span class="previous-entries"><?php next_posts_link('Previous Entries') ?></span> <span class="next-entries"><?php previous_posts_link('Next Entries') ?></span></div><!-- /page nav -->
    
    	<?php else : ?>
    
    		<h2>Not Found</h2>
    		<p>Sorry, but you are looking for something that isn't here.</p>
    
    	<?php endif; ?>

    This is the code on Index.php. I bet it's not related to theme, as I have tried to set other theme and it doesn't show any posts either.

    Thanks in advance.

    holmes

Topic Closed

This topic has been closed to new replies.

About this Topic