WordPress.org

Ready to get started?Download WordPress

Forums

Gallery with No Image Links
3.5.1 Compatibility (2 posts)

  1. AndyWarren
    Member
    Posted 1 year ago #

    Just installed this on WordPress 3.5.1 and it appears to have no affect at all. Is it not compatible with the newest WordPress version?

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

  2. sushicodeur
    Member
    Posted 1 year ago #

    I tried the plugin as well, and it has no effect at all, here is how I rewrite it :

    add_action('after_setup_theme', 'sushi_after_setup_theme');
    
    function sushi_after_setup_theme()
    {
        remove_shortcode('gallery');
        add_shortcode('gallery', 'sushi_link_none_gallery_shortcode', 10, 1);
    }
    
    function sushi_link_none_gallery_shortcode($attr)
    {
        $output = gallery_shortcode($attr);
    
        if($attr['link'] == "none") {
            $output = preg_replace(array('/<a[^>]*>/', '/<\/a>/'), '', $output);
        }
    
        return $output;
    }

    The important part in this code is to place your code in an after_setup_theme handler.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic