I can think of a couple of options:
-
Create a new shortcode, e.g. my_gallery. You can copy the code in
wp-includes/media.php
. Look for the code staring with
add_shortcode('gallery', 'gallery_shortcode');
and then the actual
function. Rename / modify as needed. The actual img link is within
the$link
variable -
Use something like this (untested), which should work but might
strip-out all width/height from any link.
_
add_filter('wp_get_attachment_link', 'remove_img_width_height', 10, 1);
function remove_img_width_height($html) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
Related Posts:
- Automatically add this attribute to the gallery shortcode
- Replace custom gallery shortcode with default gallery shortcode
- Remove width and height attributes from [gallery] output
- Conditionally Loading JavaScript/CSS for Shortcodes
- Pass boolean value in shortcode
- Check if post/page has gallery?
- Escaping quotes from shortcode attributes
- how to have the gallery shortcode output one single UL list instead of several DL?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- How to add ‘class’ attribute into shortcode [audio]?
- Customizing gallery shortcode in 3.5
- How to handle valueless attributes in shortcodes?
- Get multiple shortcode attribute values
- wpautop() when shortcode attributes are on new lines break args array
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- conditional shortcode not working
- Add attribute to existing Shortcode
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- conditional shortcode not working
- Some doubts about gallery shortcode in WordPress
- Shortcode displays only default attribute values
- Extending Shortcode attributes
- Remove HTML content if attribute is not set / variable attributes
- Global, network-wide shortcodes or text replace functions
- getting values from a shortcode with an include
- Should I cache default WordPress gallery shortcode output?
- Numbering Image List in Gallery
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- change wordpress gallery shortcode to slider
- Why are Shortcodes Disabled in Widgets by Default?
- Add attribute to shortcode dynamically
- Remove hyperlink on gallery shortcode
- Add custom setting that uses radio button to WP Gallery
- Replace / Remove Shortcode after 1st run / post
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- Check if post has gallery images/media
- Caption shortcodes not including caption as attribute
- Gallery IDS and Captions: hide/show on a per ID basis
- How to Modify WordPress Default Image Gallery Shortcode
- Change WordPress Shortcode added in to post
- Gallery shortcode – change link file image size? (not using default fullsize image)
- add action only if gallery shortcode attribute is equal to?
- Unable to the get the gallery inserted between shortcodes
- Conditionally Loading JavaScript/CSS for Shortcodes
- Adding shortcode field to edit gallery / Gallery Settings
- How to change the output of gallery shortcode
- Replacement for gallery_shortcode function not taking all attributes
- Check if CTP category taxonomy is set in shortcode
- Passing variable in nested shortcodes
- How to use a nested shortcode to render the value of an attribute in parent shortcode
- Which wordpress function is the caption shortcode linked to?
- How to Retrieve data of Gallery Shortcode and display it above a post
- How to copy [gallery] shortcode between posts using polylang [closed]
- Which file renders the “Edit Gallery” Settings page?
- How to display NextGEN gallery in templates?
- Use full size images in a specific gallery
- How to Enable embedding WordPress default gallery in comments?
- How to add new images to existing shortcode configuration?
- Gallery shortcode is empty but magically creates a gallery
- Can we add a single caption to the gallery shortcode?
- How to process a single attribute in a SQL request twice times?
- shortcode atts not working
- Second attribute of shortcode is not changing why?
- Automatically add class-attribute to gallery?
- Shortcode Attribute contains clone of all shortcode attributes
- WordPress Gallery with ID’s Shortcode not Working
- How can I define the output of shortcode attribute value?
- Changing layout of defaul gallery output to masonry
- What makes a placeholder resizable in Tinymce?
- how to show last 5 images from the one post gallery
- Gallery Shortcode: using size=”full” doesn’t call the actual thumbnail image size
- WordPress Gallery only allowed 10 times per post
- Customizing the gallery of the post correctly
- hard code shortcode only on specific category
- Dynamic number within shortcode
- How to turn this HTML code into a shortcode? (adding song lyrics and giving an id to a div)
- Making jQuery-based galleries with WordPress without a plugin?
- how to stop a gallery slideshow
- Personalized Gallery what are my options?
- get_queried_object_id / short code returning blank
- Video shortcode, option are not rendered
- ACF repeater + group shortcode
- Custom shortcode skips every 2nd shortcode
- Create shortcode for each form field in contact form 7
- Build Clickable Link Using Multiple Attributes
- Set redirect for need login
- Getting Shortcode Attributes befor content is displayed by the template
- make user_id in a shortcode dynamic based on who’s logged in
- How to add site tags in alphabetical order to shortcode?
- How can i strip shortcode from HTML title tag?
- Can’t render shortcode when html tag contains hyphen
- Custom default settings for WP native Gallery Block
- Adding shortcode of “Random Content” Plugin in the post after the title
- Shortcode won’t take into account custom post ID put in parameter
- Show content if user left comment / non-logged visitors?
- How to insert current user ID/entry ID into a shortcode?
- How to remove double quotes in a shortcode?
- Auto embeds don’t work for attachment descriptions