[wp-trac] [WordPress Trac] #29237: Add Link Size Parameter to Gallery Shortcode
WordPress Trac
noreply at wordpress.org
Sun Oct 11 04:13:26 UTC 2015
#29237: Add Link Size Parameter to Gallery Shortcode
--------------------------------------+---------------------------
Reporter: cliffseal | Owner: DrewAPicture
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 4.4
Component: Gallery | Version: 3.9.2
Severity: normal | Resolution:
Keywords: dev-feedback needs-patch | Focuses:
--------------------------------------+---------------------------
Changes (by DrewAPicture):
* keywords: dev-feedback has-patch => dev-feedback needs-patch
Comment:
The more I look at this, the less I like the idea of introducing a new
attribute. I think the one good viable option would be to allow the `link`
attribute to accept an image size. Passing 'full' would be the same as
passing 'file', but that would be OK.
Also, the original patch over complicated generating the link. Pretty much
all we'd have to do is handle the `empty` and `none` possibilities, then
fall back to the image sizes.
For example:
{{{#!php
<?php
if ( ! empty( $atts['link'] ) ) {
if ( 'none' === $attr['link'] ) {
$image_output = wp_get_attachment_image( $id,
$attr['size'], false, $attr );
} else {
// Pass $attr['link'] as the image size.
$image_output = wp_get_attachment_link( $id,
$attr['link'], false, false, false, $attr );
}
} else {
// $attr['link'] is empty, so just use $attr['size'].
$image_output = wp_get_attachment_link( $id, $attr['size'], true,
false, false, $attr );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29237#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list