How to show posts tagged by …
-
Hi. I want to show 4 posts that tagged with “test”.
I used this code:<ul> <?php // The Query $the_query = new WP_Query( 'showposts=4&tag=test' ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Post Data wp_reset_postdata(); ?> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php echo get_permalink(); ?>" target="_blank" rel="nofollow" alt="<?php echo mb_substr(the_title('', '', FALSE), 0, 55); ?> " title=" <?php echo mb_substr(the_title('', '', FALSE), 0, 55); ?>" > <?php echo mb_substr(the_title('', '', FALSE), 0, 55); ?></a><span><?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?></span></li> <?php endwhile;?><?php wp_reset_query(); ?> </ul>
But it shows all posts that 4 first posts, has not any link and style!
What I do?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘How to show posts tagged by …’ is closed to new replies.