Hi there, is there a parameter for MediaPress shortcodes to not show empty galleries?
As you can see here https://piratemc.com/gallery/
A user created 3 empty galleries on their profile, which for some reason are shown?Hello Tom,
Thank you for posing. Currently, Gallery shortcode is not supported hiding empty gallery feature. But you can use the following code in Active Child Theme “functions.php” or “bp-cutom.php” file:
add_filter( 'mpp_shortcode_list_gallery_query_args', function ( $args ) { $meta_query = array( array( 'key' => '_mpp_media_count', 'value' => 1, 'compare' => '>=', ), ); if ( isset( $args['meta_key'] ) ) { $meta_query[] = array( 'key' => $args['meta_key'] ); unset( $args['meta_key'] ); } $args['meta_query'] = $meta_query; return $args; } );
It will hide all empty galleries listed using gallery shortcode. Please give it a try and let me know if it works or not.
Regards
Ravi
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] MediaPress shortcode parameter to not show empty galleries’ is closed to new replies.
This topic is: resolved