Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter peepntom

    (@peepntom)

    <div class="attachment-image"><a href="<?php echo wp_get_attachment_url(); ?>"><img src="<?php echo wp_get_attachment_url(); ?>" alt="<?php the_title_attribute(); ?>" /></a></div>

    i want to change it so i can have a url when users click the pic not the full path to attached pic

    The plugin is designed to work with the [gallery] shortcode, which your snippet does not appear to be using.

    However, if you’re trying to modify that code to use the custom url on all images instead of the attachment url, see this thread:

    https://www.ads-software.com/support/topic/wp_get_attachement-url-get-img-url

    Thread Starter peepntom

    (@peepntom)

    how would i insert the code?

    to replace <?php echo wp_get_attachment_url(); ?> ill play around see if i can get it

    Thread Starter peepntom

    (@peepntom)

    how can i point it to the attachment image instead of the thumb? im looking through your code now

    Linking to the original media file or attachment page in a gallery should already be a built-in option, unless your theme is choosing to ignore it. Is the above snippet coming from your theme’s post_gallery filter for the [gallery] shortcode, or is it a single image inserted into the post?

    If you want to modify your theme code to link to a different size image that WordPress generates automatically when the file is uploaded, you’d probably want to use the wp_get_attachment_image_src() function:

    https://codex.www.ads-software.com/Function_Reference/wp_get_attachment_image_src

    which is different than using the custom link value that this plugin stores.

    Thread Starter peepntom

    (@peepntom)

    it is on the attachment page file attachment.php

    gallery images –> single pic –> full url to pic /uploads/mypic.jpg

    Unfortunately updating the code for your attachment page is outside the scope of what this plugin handles (which is WordPress gallery links). I’d recommend starting with your attachment.php file and looking at the wp_get_attachment_image_src() function, or maybe one of the related functions at the bottom of its WordPress codex page. Good luck!

    Thread Starter peepntom

    (@peepntom)

    how hard would it be just to add the field like the link url? attachment page right now i have a random url script when they click the pic it sends them to a random sponsor. i think advanced custom fields with do the trick

    Thread Starter peepntom

    (@peepntom)

    actually it was a easy task just adding some short code in the theme func and in the attachment.php case closed

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘link large image of the gallery’ is closed to new replies.