[Plugin: Media Tags] Conditional Testing
-
Hi All
Maybe somebody can help me here?
I’ve been trying to do this for days now with no success.
I’m trying to use the “in_mediatag()” function to add a class, but just not getting it right. There don’t seem to be any examples on the site. I’d like to use it in a function that was shown at https://digwp.com/2009/08/awesome-image-attachment-recipes-for-wordpress/This is what I’m trying:
if (in_mediatag('choice')){ echo ' my-choice-item'; }
In context:
function gallery_toolbox($size = thumbnail) { if($images = get_children(array( 'order' => 'ASC', 'orderby' => 'menu_order', 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, // display the amount to show per post 'post_status' => null, 'post_mime_type' => 'image', ))) { foreach($images as $image) { $attimg = wp_get_attachment_image($image->ID,$size); $atturl = wp_get_attachment_url($image->ID); $attlink = get_attachment_link($image->ID); $atttitle = apply_filters('the_title',$image->post_title); $postlink = get_permalink($image->post_parent); $posttitle= get_the_title($image->post_parent); echo '<dl class="gallery-item'; if (in_mediatag('choice')){ echo ' my-choice-item'; } echo '"><dt class="gallery-icon"><a href='.$attlink.' >'.$attimg.'</a></dt><dd class="gallery-caption"><a href='.$attlink.'>'.$atttitle.'</a></dd></dl>'; } } }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘[Plugin: Media Tags] Conditional Testing’ is closed to new replies.