Custom sort galleries on main page
Using the "sunshine_get_galleries_args"
filter, you can customize the sort order of galleries on just the main Client Galleries page while leaving the default sorting for all sub-galleries to your settings.
add_filter( 'sunshine_get_galleries_args', 'custom_sunshine_change_gallery_order' );
function custom_sunshine_change_gallery_order( $args ) {
$main_page_id = SPC()->get_page( 'home' );
if ( ! empty( $main_page_id ) && is_page( $main_page_id ) ) {
$args['order'] = 'DESC'; // Change this to whichever you need: ASC or DESC.
$args['orderby'] = 'title'; // Change what is used to alter the sort: title, menu_order, date.
}
return $args;
}
Learn how to add this custom code to your WordPress website
Still need help?
If you have not yet found your answer in the documentation articles, please contact support