Support » Plugin: Media Tags » adding tags to caption

  • I’m sprucing up my image captions and trying to combine your media tags with another plugin that adds a custom field to captions. It’s my way of hacking to the answer because I’m a novice. See the work in progress here: http://bitsybride.com/test/

    I have it all set up and just need to make that display_item_callback function work, but I’m not that familiar with functions. I was trying to combine it with another function that sets up the formatting for the caption. I’m sure you will be horrified, but here is my failed attempt:

    add_filter( 'img_caption_shortcode', 'wp_image_credit_img_caption_shortcode', 10, 3 );
    function wp_image_credit_img_caption_shortcode($attr, $content, $html){
    
    	$content = (object)$content;
    	$credit = wp_image_credit_get_credit_link(substr($content->id, strpos($content->id, "_") + 1));
    	$mediaTags = get_attachments_by_media_tags();
    
    	$result = <<<END
    	<div id="{$content->id}" class="wp-caption {$content->align}" style="width: {$content->width}px">{$html}</span><p class="wp-caption-text"> {$content->caption} <div style="float: right; width: 50%;"><p class="wp-caption-text"></br>$credit</p></div><div style="float: left; width: 50%;"><p style="font-size:12px"></br> tags: $mediaTags</style></p></div></div>
    END;
    	return $result;
    }

    Do you know what I need to do to make your tags show up?

    http://wordpress.org/extend/plugins/media-tags/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here is another failed attempt:

    add_filter( 'img_caption_shortcode', 'wp_image_credit_img_caption_shortcode', 10, 3 );
    function wp_image_credit_img_caption_shortcode($attr, $content, $html){
    	global $post;
    	$content = (object)$content;
    	$credit = wp_image_credit_get_credit_link(substr($content->id, strpos($content->id, "_") + 1));
    	$mt_terms = the_mediatags($id = 0);
    
    	$result = <<<END
    	<div id="{$content->id}" class="wp-caption {$content->align}" style="width: {$content->width}px">{$html}</span><p class="wp-caption-text"> {$content->caption} <div style="float: right; width: 50%;"><p class="wp-caption-text"></br>$credit</p></div><div style="float: left; width: 50%;"><p style="font-size:12px"></br> tags: coming soon! $mt_terms </style></p></div></div>
    END;
    	return $result;
    }
    Plugin Author Paul Menard

    (@pmenard)

    bitsybride, Let me know if you still need help on this.

    bitsybride, Did you ever figure it out? I’m trying something similar. I can’t get the_mediatags to return anything.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘adding tags to caption’ is closed to new replies.