Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter martinft

    (@martinft)

    Is it possible to get an answer with premium support?

    Plugin Author bradvin

    (@bradvin)

    hi

    You have a few options:

    1) you could create a custom album template that loads last X galleries
    2) you could alter your theme template code to include the last X galleries.

    A foogallery is a custom post type, so you could use a post query to load the last 3 galleries that were modified. The one problem I forsee is that the gallery can be used on multiple pages, so determining the page could be a bit tricky.

    This code might help (please note I have not tested it):

    //args for loading 5 galleries order by last modified
    	$args = array(
    		'post_type'     => FOOGALLERY_CPT_GALLERY,
    		'post_status'	=> array( 'publish', 'draft' ),
    		'order' => 'ASC',
    		'orderby' => 'modified',
    		'posts_per_page' => 5
    	);
    
    	//run the query
    	$gallery_posts = get_posts( $args );
    
    	//loop through the galleries
    	foreach ( $gallery_posts as $post ) {
    		$gallery = FooGallery::get( $post ); //load the gallery
    
    		$page = $gallery->find_usages()[0]; //find first page it is used (this may break)
    
    		//render link to the page etc here
    	}
    Thread Starter martinft

    (@martinft)

    Great, thanks for your answer bradvin!
    Is there also a possibility to find the albums a gallery is part of (instead of pages)?

    Thanks,
    Martin

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show last modified galleries’ is closed to new replies.