• Hello how can i make in there are more tags to be shown like thie: tag1, tag2, tag3
    I need to use this code

    <?php
    $posttags = get_the_tags('');
    if ($posttags) {
    foreach((get_the_category()) as $category)
    foreach($posttags as $tag) {
    echo ' <a href="?cat='.$category->cat_ID . '&tdo_tag=' . $tag->name . '">' . $tag->name . '</a>,' ;}
    }?>

    but how to separate each tag with comma?
    thanks for help

Viewing 2 replies - 1 through 2 (of 2 total)
  • $tags = get_the_tags($post->ID);
    					if($tags) :
    						foreach($tags as $tag) :
    							$sep = (empty($keywords)) ? '' : ', ';
    							$keywords .= $sep . $tag->name;
    							echo '<a href="https://www.site.com/blog/tag/'.$tag->name.'/" rel="tag">'.$tag->name.'</a>, ';
    						endforeach;
    					endif;

    Hope it helps.

    Okay guy, but it shows the tags of the last post for every post with tags.
    Its strange.

    }elseif($btype == 'dynamictag' && (is_single())){
    			$tags = get_the_tags($post->ID);
    					if($tags) :
    						echo 'bb_keywords = "';
    						foreach($tags as $tag) :
    							$sep = (empty($keywords)) ? '' : ', ';
    							$keywords .= $sep . $tag->name;
    							echo $tag->name .', ';
    						endforeach;
    						echo '";';
    					endif;
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with separate tags with get_the_tags’ is closed to new replies.