Viewing 7 replies - 1 through 7 (of 7 total)
  • That is weird. I don’t usually use tags, so I never noticed this before. Maybe that’s a big fat WP Whoops (or WhooPs)?? Or maybe it has to do with the fact that tags and categories are so closely related and can be converted. Maybe it’s there to house an incoming category’s description. Not sure, just thinking out loud here.

    Thread Starter chanpory

    (@chanpory)

    Yeah, quite weird. It’d be nice to have the feature.

    Thread Starter chanpory

    (@chanpory)

    Okay, I figured out some hacks to get Tag description working. They’re core hacks for now. I assume it could be turned into a plug-in but I have little experience in that. For now, here’s what you can do to enable Tag Descriptions.

    In wp-admin/edit-tag-form.php, add the following code right before the </table> tag:

    <tr class="form-field">
    			<th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
    			<td><textarea name="description" id="tag_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($tag->description); ?></textarea><br />
                <?php _e('The description is snot prominent by default, however some themes may show it.'); ?></td>
    		</tr>

    This will create a description field in the edit tags form in WordPress admin.

    Next, in wp-includes/general-template.php, add the the following function:

    function single_tag_description($prefix = '', $display = true ) {
    	if ( !is_tag() )
    		return;
    
    	$tag_id = intval( get_query_var('tag_id') );
    
    	if ( !empty($tag_id) ) {
    		$my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display');
    		if ( is_wp_error( $my_tag ) )
    			return false;
    		$my_tag_description = apply_filters('single_tag_description', $my_tag->description);
    		if ( !empty($my_tag_description) ) {
    			if ( $display )
    				echo $prefix . $my_tag_description;
    			else
    				return $my_tag_description;
    		}
    	}
    }

    This will allow you to display the Tag’s description text on a Tag archive page. Just put in this code into your theme:

    <?php single_tag_description(); ?>

    Hope that helps anyone who wondered why Tag description text was omitted

    willzhou

    (@willzhou)

    You can see this plugin
    Tag Description
    https://willamber.com/tag-description/

    Is this plugin no longer available? Anyone have any luck getting this to work? The page does not load for me.

    Nice solution!

    However, for layout proposals I need to check if single_tag_description is true or not for TAG archive, in order to display the description (if true) or something else (if false).

    I really don’t how to do this. Any Help?

    Just made a simple plug-in that does Tag Descriptions For WordPress using some of the code here.

    Enjoy! ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Tag description text?’ is closed to new replies.