Getting tags with WP_Query
-
Hello again
I can’t find a way to make my tags appear when I use WP_Query to display my posts.
<?php $cat_posts = new WP_Query('cat=-5&orderby=post_date&posts_per_page=1'); ?> <?php if($cat_posts->have_posts()) : ?><?php while($cat_posts->have_posts()) : $cat_posts->the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h1><?php the_title(); ?></h1> <h3>Wrote post in: <?php the_tags('', ', ', ''); ?> </h3> <?php ob_start(); the_content(); $content = ob_get_clean(); echo $content; ?> </div> <?php endwhile; ?> <?php endif; ?>
I found out that the_tags returns an array, but what to do with that to make it display?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Getting tags with WP_Query’ is closed to new replies.