• Resolved farinha

    (@farinha)


    In my homepage, the tags for the first post are not being displayed for some reason. The only thing I think may have messed it up was the code I added to float the first post of a certain category to the top. it seems to be working fine, but the tags for that post are not showing (although they are applied to the post because the tag page shows it, and also the single post page displays the tags correctly.

    Here’s the code I’m using to display the posts in the main page:

    <?php $my_query = new WP_Query('category_name=Personal&showposts=1');
    	while ($my_query->have_posts()) : $my_query->the_post();
    	$do_not_duplicate = $post->ID;?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    			<?php the_title(); ?></a> <span class="date"><?php the_time('d.m.y') ?></span>
    		</h2>
    		<div class="entry">
    			<?php the_content('Continue Reading &rarr;'); ?>
    		</div>
    	<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?>
    	  <span class="authr">
          <?php _e('Posted by','padangan');?> <?php the_author() ?></span>
          in <?php the_category(', ') ?>
          <?php edit_post_link('Edit', '<span class="editr">', '</span>'); ?>
          <span class="commr">
          <?php comments_popup_link('No Comments &rarr;', '1 Comment &rarr;', '% Comments &rarr;'); ?>
          </span></p>
    
    	</div>
    
    	<?php endwhile; ?>
    
      <?php if (have_posts()) : ?>
      <?php while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate) continue; ?>
      <div class="post" id="post-<?php the_ID(); ?>">
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
          <?php the_title(); ?></a> <span class="date"><?php the_time('d.m.y') ?></span></h2>
        <div class="entry">
          <?php the_content('Continue Reading &rarr;'); ?>
        </div>
    <p class="postmetadata">
      <?php the_tags('Tags: ', ', ', '<br />'); ?>
    	  <span class="authr">
          <?php _e('Posted by','padangan');?> <?php the_author() ?></span>
          in <?php the_category(', ') ?>
          <?php edit_post_link('Edit', '<span class="editr">', '</span>'); ?>
          <span class="commr">
          <?php comments_popup_link('No Comments &rarr;', '1 Comment &rarr;', '% Comments &rarr;'); ?>
          </span></p>
    
      </div>
    
    	<?php endwhile; ?>

    Can you spot any problem with it?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Tags not showing for first post in homepage’ is closed to new replies.