• pan69

    (@pan69)


    In previous versions of WP you were able to save a gallery without actually inserting it into a post. This was handy since it allowed for easy gallery creation that wasn’t part of the core content of your page.

    I used to use the following function to retrieve the gallery but unfortunately this no longer works with the revamped gallery functionality since the Save Gallery option is no longer there:

    function get_gallery( $post_ID = NULL )
    	{
    		global $wpdb;
    
    		if( empty( $post_ID ) )
    		{
    			$post_ID = get_the_ID();
    		}
    
    		$gallery = $wpdb->get_results(
    			$wpdb->prepare("
    				SELECT * FROM ".$wpdb->prefix."posts
    				WHERE
    				post_parent=%d
    				AND
    				post_type='attachment'
    				AND
    				menu_order > 0
    				AND
    				post_status='inherit'
    				AND
    				post_mime_type LIKE '%%image%%'
    				ORDER BY menu_order ASC", $post_ID
    			)
    		);
    
    		return $gallery;
    	}

    Is there any way to retrieve a gallery in a similar fashion with the new gallery functionality?

  • The topic ‘3.5.1 Gallery problems’ is closed to new replies.