WordPress.org

Ready to get started?Download WordPress

Forums

Galleria WP
Exclude featured image from Galleria? (1 post)

  1. trixienolix
    Member
    Posted 2 years ago #

    I love this plugin for its simplicity. However it's not been updated for ages and so there are new things creeoping in that need sorting.

    How do I exclude the featured image from the galleria? I know who to do it with a normal wp gallery... but not this galleria plugin. ANy help would be appreciated.

    here's code for a normal gallery (put this in functions.php)

    function exclude_thumbnail_from_gallery($null, $attr)
    {
        if (!$thumbnail_ID = get_post_thumbnail_id())
            return $null; // no point carrying on if no thumbnail ID
    
        // temporarily remove the filter, otherwise endless loop!
        remove_filter('post_gallery', 'exclude_thumbnail_from_gallery');
    
        // pop in our excluded thumbnail
        if (!isset($attr['exclude']) || empty($attr['exclude']))
            $attr['exclude'] = array($thumbnail_ID);
        elseif (is_array($attr['exclude']))
            $attr['exclude'][] = $thumbnail_ID;
    
        // now manually invoke the shortcode handler
        $gallery = gallery_shortcode($attr);
    
        // add the filter back
        add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);
    
        // return output to the calling instance of gallery_shortcode()
        return $gallery;
    }
    add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);

    http://wordpress.org/extend/plugins/galleria-wp/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic