WordPress.org

Ready to get started?Download WordPress

Forums

On gallery, no link on FILE (5 posts)

  1. tecnosh
    Member
    Posted 5 years ago #

    Hello,

    I use the new Gallery System on worpress with a size that need to be always the same. Already ahve it and everything its working good.

    The only problem is that I DON'T need the links to the image URL on each image gallery. Just want to insert the [gallery.. ] and have NO images links.

    I find the code that set the link on each image.. but don't know what to remove.

    <!-- see gallery_shortcode() in wp-includes/media.php -->
    <div class='gallery'>");
    $i = 0;
    foreach ( $attachments as $id => $attachment ) {
    
    $link = isset($attr['link']) &amp;&amp; 'file' == $attr['link'] ? 
    
    wp_get_attachment_link($id, $size, false) : wp_get_attachment_link($id, $size, false);
    
    $output .= "
    <br style='clear: both;' />
    </div>\n";
    
    return $output;
    }

    Thanks,

  2. JosVelasco
    Member
    Posted 4 years ago #

    Any ideas on this?

    I'd like to have something like [gallery link="none"] instead of [gallery link="attachment"] or [gallery link="file"]

  3. Jayde
    Member
    Posted 4 years ago #

    I did this using jQuery to remove the link for the user. For the spiders, I set it to link="file" so that the spiders don't crawl to a useless page.

    I don't like modifying the core files since it'll break again every time you upgrade your WP installation. Hope this helps.

    $(document).ready(function(){
    	// Remove link from gallery images
    	$(".gallery-icon a").each(function () {
    		$(this).replaceWith($(this.childNodes));
    	});
    });
  4. kaiday
    Member
    Posted 4 years ago #

    @Jayde
    Thanks for your response. Where did you place this code?

  5. axelav
    Member
    Posted 4 years ago #

    @Jayde

    Very interested in the answer to the above question. I'm struggling to figure out how to get the links removed from these images.

Topic Closed

This topic has been closed to new replies.

About this Topic