Viewing 4 replies - 1 through 4 (of 4 total)
  • The basic idea is to use get_the_term_list() with your attachment ID and the ‘media-tags’ taxonomy.

    <?php
    $media_items = get_attachments_by_media_tags('media_tags=vacation');
    if ($media_items) {
    foreach ($media_items as $media_item) {
    $itemtags = get_the_term_list($media_item->ID, 'media-tags');
    echo $itemtags;
    } }
    ?>
    Thread Starter master412160

    (@master412160)

    Isn’t that code for the media tag vacation only?

    Plugin Author Paul Menard

    (@pmenard)

    @master412160,

    There is actually a template function for this. When displaying a loop of media-tagged items you can call the function the_mediatags() and a comma separated list of the tags used for the image will be shown.

    This is similar to the WordPress template function the_tags();

    Thread Starter master412160

    (@master412160)

    Could you write a code for that? Simple like above. I’m not that good in this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What code to use to display the tags in the front?’ is closed to new replies.