• Resolved Jason Robinson

    (@jsrobinson)


    Hi there! Thank you for the super-useful plug-in! I am trying to figure out how to get the media-tags for a given image as I am looping through my custom callback function.

    I tried something like:
    class=”‘.the_terms( wp_get_post_tags->ID, array( ‘fields’ => ‘ids’ ) );.'”

    and it doesn’t work. Is there an easy way to go about this? Is the taxonomy custom for media-tags?

    https://www.ads-software.com/plugins/media-tags/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Jason Robinson

    (@jsrobinson)

    I should note than the above example was trying to extract the IDs of the tags so I could then get the name/slug of each, I’ve also tried:

    class="'.the_terms( $post->ID, 'attachment', '', ' ' );.'"

    Thread Starter Jason Robinson

    (@jsrobinson)

    and this doesn’t work either

    class="'.the_terms($post_item->ID,'taxonomy=media-tags','',' ','').'"

    Thread Starter Jason Robinson

    (@jsrobinson)

    ok, I need to stop copying/paste!

    "'.the_terms($post_item->ID,'media-tags','',' ','').'"

    is working a lot closer to what I need. Now to get rid of the linkage!

    I ended up using
    https://codex.www.ads-software.com/Function_Reference/wp_get_object_terms

    and looping through to get the exact output I wanted.

    Plugin Author Paul Menard

    (@pmenard)

    @jsrobinson,

    Thanks for writing. So I see you have the solution to your own question.

    Correct, the Media-Tags plugin simply creates a custom taxonomy. So you can use the WordPress functions as needed.

    As part of the plugin there are also some template functions you can use. For example there is a function ‘the_mediatags()’ which is similar to the WordPress ‘the_cateogies()’ for the post categories taxonomy and ‘the_tags()’ for the post tags taxonomy. Check out the plugin file mediatags_template_functions.php

    Let me know if you need any more help.

    Thread Starter Jason Robinson

    (@jsrobinson)

    thank you for the pointer for the helper functions, definitely been spending some time in there today ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Get tags into class?’ is closed to new replies.