add_filter( 'wp_get_attachment_link', 'sant_prettyadd', 10, 6);
function sant_prettyadd ($content, $id, $size, $permalink, $icon, $text) {
if ($permalink) {
return $content;
}
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$content,1);
return $content;
}
Update:
function sant_prettyadd checks permalink argument.
if the permalink = true
then it returns the content as it is.
if the permalink = false
then it skips to the next line and replace the <a
with <a rel="prettyPhoto[slides]"
and then returns the content.
Related Posts:
- How to remove title attribute from gallery links and images
- Exclude images from “inserted into post” when trying to get attachments
- Customizing the attachement page to show rest of all images in a gallery from post
- One picture belonging different galleries?
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- attachment.php & flexslider—linking thumbnail to specific image
- Image Attachments Query Not Working If Post Is Loaded Via Ajax
- Programmatically adding images to media library
- How do I delete all UNUSED images from my uploads directory?
- Programmatically get images by URL and save in uploads folder
- How to extend the gallery block in Gutenberg?
- how to get original image using wp_get_attachment_image_src
- Can I attach image to post without adding it to post?
- Prevent WordPress from adding image’ title automatically
- Overide Gallery Default Link to Settings
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- get_post_gallery with Gutenberg
- How to have different captions for same image, for galleries?
- wp_get_attachment_image_src and server path
- get_post_gallery_images returns thumbs . I want full size
- How to find attachment by it’s name?
- WP 3.5 and Galleries – how to count images?
- Navigate with keyboard in Gallery shortcode
- Cropped featured image replaces original image in gallery
- How do I delete all generated images from my server except those currently used in posts
- get images from post and make a zip
- Insert an image into a post by API
- Function to call the attachment image from post
- Theme Customiser Image Control
- Bulk edit wordpress images alt and title attributes
- Change the output for [gallery] shortcode
- How can I hide media library images from general users?
- Making WordPress Gallery (.gallery-item) Responsive?
- How do you modify the HTML output of a Gallery item (using the gallery shortcode)?
- Get attachment ID of author_meta image – Attachment Metadata
- How to include externally hosted images into a gallery block
- Associate an existing image with a post
- Programatically creating image attachments from local URLs and setting featured image
- Excludes posts that don’t have attachments in the_content()
- Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms…)
- How do i upload an image and return the image id?
- Get Attachment ID from URL [duplicate]
- Setting up a gallery with images and a zip download
- Separate attachment images from post loop
- How can I make all gallery images to open in a new window?
- How to display a shortcode caption somewhere other than the_content
- copy attachment title to description and alt text
- The WordPress Gallery, Grabbing The Link and Images?
- Get an image from url in front end submission form
- Open the attachment details modal
- Displaying a featured image (only img url) as the img src?
- How to upload image without post ID using the new media uploader?
- How do I delete thousands of unattached images?
- Allowing post attachments without allowing to insert in text
- How to force WordPress to add new images at the beginning of the gallery?
- Applying class to links around self hosted images embedded to posts/pages
- Rename attachments during upload
- How to link Gutenberg Gallery images To Media file automatically?
- Regex to turn embedded images in to attachments
- Re-process Images
- Show prev and next post links for parent post of current image in attachment page?
- How to Make WordPress Default gallery responsive on mobile?
- Get a Page’s attachments in Gallery order
- Pulling Post Image Attachments in WordPress 3.9
- get attributes/part of the gallery shortcode
- Link Featured Thumb to Attachment Page, If Possible
- Different captions for the same image in multiple galleries. Edit Image in Gallery locally
- Regenerate missing _wp_attachment_metadata
- Make alt text required when setting a featured image
- Image still linked as attachment to page even though it has been deleted
- Editing built in Gallery shortcode to filter by categories
- Gallery images stored elsewhere (preferably Google Drive)
- WordPress gallery previous/next buttons showing all media library images
- Any way to “combine” galleries or show multiple galleries as one?
- Display one random image, but only if landscape
- get_attachment_id() only get id of first attached image after post update
- Why can I not view image attachment pages?
- Add image attachment to post via coding?
- Is there a way to get attachment data?
- How to change image url?
- Best option for photo/gallery handling?
- Add a new data attribute in tag
- Gallery post images on homepage?
- Custom page template to display all image attachments
- How to create a simple slideshow out of a post image gallery?
- Link to full size image or attachment page in photo theme
- get the image of the post
- add the post as canonical for attachment page wordpress
- How to change the target size of images clicked on in WordPress standard gallery
- Get meta data from image
- Exclude featured image from gallery in wp-admin
- media_sideload_image with rewritten urls?
- WooCommerce-like featured gallery
- Override img class in gallery
- Add an attribute to attachments
- Pull Random Attachments With Pagination
- Extracting gallery images in WordPress 3.5 on index.php
- Out of memory error reporting
- How can I attach hotlinked images in posts/pages within the same server?