Filters

Descriptions

rtm_sort_label


Filter is use to modify sort label in media galllery.

add_filter( 'rtm_sort_label', 'rtmedia_sort_label', 10 ,1 );

function rtmedia_sort_label( $label ) {
    if ( 'sort' == $label ) {
        $label = 'Arrange';
    }
    return $label;
}

rtmedia_change_sort_parameters_label


Filter is use to modify Sort parameters label in galllery shortcode.

add_filter( 'rtmedia_change_sort_parameters_label', 'rtm_change_sort_parameters_label', 10, 1 );

function rtm_change_sort_parameters_label ( $rtmedia_sort_labels ) {
    $rtmedia_sort_labels['new'] = 'Latest';
    $rtmedia_sort_labels['like'] = 'Favorites';

    return $rtmedia_sort_labels;
}

If you want to removes Sort menu from gallery Shortcode then you can use this filter.

add_filter( 'rtmedia_gallery_sort_actions', 'rtm_remove_rtmedia_gallery_sort_actions', 10, 1 );

function rtm_remove_rtmedia_gallery_sort_actions( $options ) {
  global $rtmedia_query;
  if (isset( $rtmedia_query->is_gallery_shortcode ) && $rtmedia_query->is_gallery_shortcode ) {
    return array();
  }
  return $options;
}

rt_upload_hf_sort_by


Sets parameter in hidden field for default order by

/**
 *
 * Sets parameter in hidden field for order by
 *
 */
function rtmedia_hf_sort_by( $sort_by ) {

	// if it's not json data
	if ( ! isset( $_REQUEST['json'] ) ) {

		// 'title': if Title (ASC OR DESC)
		// 'date' : if Upload date (ASC OR DESC)
		// 'size' : if file size (ASC OR DESC)
		$sort_by = 'title';
	}

	return $sort_by;

}
add_filter( 'rt_upload_hf_sort_by', 'rtmedia_hf_sort_by');

rt_upload_hf_sort_order


Sets parameter in hidden field for default order ( asc or desc )

/**
 *
 * Sets parameter in hidden field for sort order
 *
 */
function rtmedia_hf_sort_order( $sort_order ) {

	// if it's not json data
	if ( ! isset( $_REQUEST['json'] ) ) {

		// 'desc' : if title, size or date DESC
		// 'asc'  : if title, size or date ASC
		$sort_order = 'asc';
	}

	return $sort_order;

}
add_filter( 'rt_upload_hf_sort_order', 'rtmedia_hf_sort_order');