• hi

    I’m using a custom select to retrieve my posts for my posts page instead of the loop. I need to get each posts tags as I display the post.

    get_the_tags($post->ID);
    this (above) seems to work and then I have to construct my string from the arrays, making sure I add links and commas between tags etc.

    is there an easier way to do this?

    a+
    gar

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi asquare, did you get a solution to this ? I’m involved in the same issue.

    <?php the_tags('<span class="taglist"><strong>Tags:</strong></span> &nbsp;', ', ', ''); ?>

    Hi whooami, I tried this inside a custom query with get_posts, but it didn’t work.

    Here’s what I found to solve it. If someone knows a better way, please share it !

    <?php
    		 $posts = get_posts('category=4&numberposts=1');
    		 foreach($posts as $post):
    			setup_postdata($post);
    		 ?>
    		<?php the_title(); ?>
    		<?php the_content(); ?>
    
    		<!-- HERE IT COMES THE TRICKY PART -->
    
    		<?php $posttags = get_the_tags($post->ID);
    		if ($posttags) {
    		foreach($posttags as $tag) {
    		echo $tag->name . ' ';
    		}
    		}
    		?>
    		<?php endforeach; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘retrieving tags’ is closed to new replies.