WordPress.org

Ready to get started?Download WordPress

Forums

Eazyest Gallery
How do I display the 5 most recent galleries? (2 posts)

  1. thegreatdanton
    Member
    Posted 6 months ago #

    Hi,

    On the home page of my website I would like to display the 5 most recent galleries added to the Eazyest Gallery. However, I'm not sure how to do this. See screenshot here of how the website currently looks: http://oi42.tinypic.com/25a7kuw.jpg

    It continues to add galleries. Ideally the "Brian Corcoran" gallery would be hidden once the "U10s in Clonmel" was added. I would appreciate some advice.

    Thank you.

    http://wordpress.org/plugins/eazyest-gallery/

  2. klihelp
    Member
    Plugin Author

    Posted 5 months ago #

    Use WP_Query WordPress API:

    list( $orderby, $order) = explode( '-', eazyest_gallery()->sort_by( 'folders' ) );
    
    global $wp_query;
    $args = array(
        'post_type'      => eazyest_gallery()->post_type,
        'post_parent'    => $post_id,
        'posts_per_page' => -1,
        'order' => $order,
        'orderby' => $orderby,
    );
    $query = new WP_Query( $args );
    
    if ( $query->have_posts() ) {
    
       // see variables in $query
        var_dump($query);
    
    }

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.