Media Tags
Use a variable in the tag selection (i.e. media_tags=$tagname) (2 posts)

  1. jamieisboss
    Posted 2 years ago #

    I have implemented a custom meta box in a template where I am also using media tags to generate a list of images for an image slider.

    I want to be able to us the data from this meta box to choose which tag is selected by for use in the slider:

    Right now each template is as so:

    $media_items = get_attachments_by_media_tags('media_tags=vacation');

    I have a variable:

    `global $mediatag_selector;

    $thistag = $mediatag_selector->the_value('s_single');'

    and I'd like to be able to use that variable to define which media tag is selected

    to acheive an equivalent to this:

    $media_items = get_attachments_by_media_tags('media_tags=$thistag');

    Is this even possible? I'm kind of learning this php as I go and I'm not sure if I'm trying to do something impossible.




  2. mic79
    Posted 2 years ago #

    @jamieisboss: You probably figured it out by now, but just for the record, like this it should work:
    $media_items = get_attachments_by_media_tags('media_tags='.$thistag);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Media Tags
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic