WordPress.org

Forums

Media Credit
[resolved] Latest WP updates or caption handling break Media Credit (4 posts)

  1. artc1209
    Member
    Posted 3 years ago #

    The last couple of point releases of WP seem as if they've broken Media Credit.

    When an image is placed, the ending shortocde [/media credit] is visible as part of the caption.

    What happens now is:

    [caption id="attachment_8193" align="alignleft" width="225"][media-credit name="Kathryn Nelson" align="alignleft" width="225"]<img src="http://www.thegrotonline.com/wp-content/uploads/2012/07/NRWA-loosestrife-monitoring-Pepperell-volunteer-Diane-Temple-225x300.jpg" alt="NRWA Purple Loosestrife Monitor Volunteer Diane Temple" title="NRWA Purple Loosestrife Monitor Volunteer Diane Temple" width="225" height="300" class="size-medium wp-image-8193" />[/media-credit] NRWA Purple Loosestrife Monitor Volunteer Diane Temple[/caption]

    And this is the result: https://dl.dropbox.com/u/2143300/7-16-2012%203-19-54%20PM.png

    Any ideas? Seemed to start around the time WP 3.3 released.

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

  2. Scott Bressler
    Member
    Plugin Author

    Posted 3 years ago #

    It is indeed broken, but I haven't had a chance to look into it in detail yet. Patches welcome!

  3. artc1209
    Member
    Posted 3 years ago #

    If you want anyone to beta test a fix or two, I'm willing.

  4. Byron
    Member
    Posted 2 years ago #

    Okay I spent a few hours getting this to work on my site. WordPress parses out part of the shortcode and it ends up disappearing into neverland, leaving the closing tag ([/media-credit]) in the caption. If we move the shortcode to not get parsed out, however, wordpress does not call the shortcode at all. Both of those issues are fixed below.

    I've spent too long looking at this to come up with a solution entirely within the plugin. However, if you need it to work on your site (like I did), you can do the following:

    1. In wp-content/plugins/media-credit/media-credit.php, replace line 262 (starts with $shcode = with
      $shcode = $html . '[media-credit ' . $credit . ' align="align' . $align . '" width="' . $width . '"]';
    2. In wp-includes/media.php, replace line 761 (starts with . do_shortcode( $content )) with
      . do_shortcode( $content ) . '<p class="wp-caption-text">' . do_shortcode( $caption ) . '</p></div>';

    Keep in mind that the second search/replace is part of the WP core and violates good plugin practice. (In fact, these changes can't be made into the plugin itself and have to be performed manually.)

    I'm sure there's a better fix but I can't think of it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

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

About this Topic