WordPress.org

Ready to get started?Download WordPress

Forums

Limit Characters for Tags (1 post)

  1. dadaas
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic