Support » Plugin: Credit Tracker » Can Credit Tracker insert a title to the img tag?

  • Resolved mccaskey

    (@mccaskey)


    Could Credit Tracker be made to assemble and insert a title into the img tag?

    I’d like, for example, an img title of

    Flikr photo ’Sunrise’ by PhotographerJoe

    This would then appear as a hover.

    Even better would be if Credit Tracker also automatically wrapped the image in a hyperlink whose source is %link%.

    https://wordpress.org/plugins/credit-tracker/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author labs64

    (@labs64)

    Hi mccaskey,

    Thank you for using Credit Tracker.

    Yes, this possible; please use something like this in ‘Copyright format’

    © Flikr photo ’%title%’ by <a href="%link%">%author%</a>

    see also Credit Tracker FAQ: https://wordpress.org/plugins/credit-tracker/faq/
    Section: “How do I use both standard caption and media credit?”

    Regarding wrapping the image in a hyperlink, we’ve created an GitHub issue: https://github.com/Labs64/credit-tracker/issues/20 and will try to implement this.

    Best Regards,
    Labs64

    That’s a way to put the author and link in the Credit Tracker caption. What I want is to change the contents of the <img> tag, so that the assembled string ends up in the title=” ” of that tag. This way the caption is available in a hover, instead of being shown in text below the image.

    Plugin Author labs64

    (@labs64)

    Got it, sorry for a confusion.

    We’ll address this change within https://github.com/Labs64/credit-tracker/issues/20 then.

    In the meantime, this change to credit-tracker-shortcodes.php is working for me:

    $content = str_replace('<img', '<img itemprop="contentUrl" title="' . $ct_copyright . '"', $content);
    
    if ($image['link']) {
    	$ret .= '<a href="' . $image['link'] . '">';
    }
    $ret .= do_shortcode($content);
    if ($image['link']) {
    	$ret .= '</a>';
    }
    Plugin Author labs64

    (@labs64)

    Hi mccaskey,

    With the new release 1.1.7 we’ve introduced media attributes substitution within ‘caption’ shortcode; so now you can define images in the post/page body as follows:

    [caption id="11"]<a href="%link%"><img src="11.png" alt="%caption%" title="%copyright%"/></a>[/caption]

    This allows plugin users to style&compose HTML code in a more flexible way.

    Best Regards,
    Labs64

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can Credit Tracker insert a title to the img tag?’ is closed to new replies.