WordPress.org

Support

Support » How-To and Troubleshooting » Limit Characters for Tags

Limit Characters for Tags

  • Hi,
    i have real trouble with tags, i see huge tags generated by autotaging plugin. So i dont like to display tags longer than 30 characters.

    I have this code to disoplay tags on template:

    <?php $posttags = get_the_tags();
    $count=0;
    if ($posttags) {
    	foreach($posttags as $tag) {
    		$count++;
    		echo '<a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a> ';
    		if( $count >12) break;
    	}
    }
    
    else print '<span>'.__('none', 'Eos').'</span>'; ?></span><?php endif; ?>

    Please if anyone knows how to adjust this code and implement that characters longer than 30 are not displayed. Or if you know the way to forbid collecting the tags that are longer than 30 in first place, please help me.

    Thanks

  • The topic ‘Limit Characters for Tags’ is closed to new replies.