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$linkvariable -
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
- Wordspress add into my javascripts
- List of all inbuilt WordPress shortcodes
- Multiple content areas per page
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Slow page loading when using a simple shortcode on the same page multiple times
- Remove and restore one shortcode
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- Combining similar shortcode functions?
- Best way to implement a thumbnail-based gallery in WordPress?
- Shortcode – Getting Categories appears on top of website
- Passing html tags as shortcode parameters
- Turn off image captions in gallery view?
- How to explode single string IF it’s used in shortcode
- Getting Page Content Using Shortcode
- Turning variable into a value set in shortcode
- Shortcode question…. javascript
- Shortcode select another dbbase
- Shortcode not interpreted if parameter set
- Using shortcode to stop post content from displaying
- Creating custom shortcode
- What is short code for following?
- Shortcode or placeholder for theme options page?
- How to call shortcode on button click
- How can you alter the name of attributes in a shortcode?
- Working with Shortcode, AJAX, Elementor