WordPress.org

Ready to get started?Download WordPress

Forums

Media Tags
adding tags to caption (4 posts)

  1. bitsybride
    Member
    Posted 1 year ago #

    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/

  2. bitsybride
    Member
    Posted 1 year ago #

    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;
    }
  3. pmenard
    Member
    Plugin Author

    Posted 1 year ago #

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

  4. cramerhwood
    Member
    Posted 12 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.