WordPress.org

Support

Update

  • Hi sators,

    A better implementation would be by subscribing to the “post_gallery” filter:

    function gallery_link_none($output, $attr = array()) {
        if (isset($attr["link"]) && $attr["link"] == "none")
            return preg_replace(array('/<a[^>]*>(<img[^>]*>)<\/a>/'), '$1', $output);
        return $output;
    }
    add_filter('post_gallery', 'gallery_link_none', 10001, 2);

    This way it works with custom gallery plugins and also addresses the issue found by “livesimplybyannie”.

    Can you please update the plugin?

    Cheers,
    Kaspars

    http://wordpress.org/extend/plugins/gallery-linknone/

Viewing 1 replies (of 1 total)
  • helgatheviking
    Participant

    @helgatheviking

    I love this idea, but it doesn’t seem to remove any links for me.

    [gallery ids="24,25,26,27" size="full" link="none" columns="1"]

    Just produces linked images like normal.

    I think because in the gallery shortcode callback you have:

    // Allow plugins/themes to override the default gallery template.
    	$output = apply_filters('post_gallery', '', $attr);
    	if ( $output != '' )
    		return $output;

    which means your filter must actually create some markup, or the shortcode will just proceed to do its default markup.

Viewing 1 replies (of 1 total)
  • The topic ‘Update’ is closed to new replies.