WordPress.org

Ready to get started?Download WordPress

Forums

Gallery Shortcode linking somewhere else (1 post)

  1. brasofilo
    Member
    Posted 3 years ago #

    i wanted the thumnails of my [gallery] linking to some specific web page... it's a sponsors page, with their logos linking to their pages, not to the image nor the attachment page...

    i used Alternate Text to put the desired link

    and then modified wp-includes/media.php line 846:

    `$linkImg = wp_get_attachment_image($id, $size, true, false);
    $linkAlt = get_post_meta($id, '_wp_attachment_image_alt', true);
    $linkMod = '<a href="'.$linkAlt.'">'.$linkImg.'</a>';

    $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : $linkMod;//wp_get_attachment_link($id, $size, true, false);`

    the first 3 are new code
    the 4th is a modification of the original line

    if [gallery link="file"] there's no change of behavior

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by brasofilo
  • This topic is not a support question
  • WordPress version: 3.0.4