- widget_title
- rtm_gallery_widget_media_type_title
- rtmedia_allow_uploader_view
- rtmedia_upload_not_allowed_message
- rtmedia_widget_show_public_media_only
- rtmedia_upload_tabs
- rtmedia_gallery_widget_ordering
- rtmedia_sidebar_widget_media_type_all_tab
Descriptions
widget_title
This filter allows to modify title of widgets.
add_filter( 'widget_title', 'rtm_widget_title', 10, 1 );
function rtm_widget_title( $title ) {
return 'rtMedia : '. $title;
}
rtm_gallery_widget_media_type_title
This filter is use to modify title of tab in gallery widget.
add_filter( 'rtm_gallery_widget_media_type_title', 'rtmedia_gallery_widget_media_type_title', 10, 3);
function rtmedia_gallery_widget_media_type_title( $strings, $type, $wdType ) {
if ( 'photo' == $type ){
$strings = 'Images';
}
return $strings;
}
rtmedia_allow_uploader_view
This filter is used to restrict uploader view from rendering.
add_filter( 'rtmedia_allow_uploader_view', 'rtm_allow_uploader_view', 10, 2 );
function rtm_allow_uploader_view ( $flag, $uploader ){
if ( 'uploader_widget' == $uploader ) {
$flag = false;
}
return $flag;
}
rtmedia_upload_not_allowed_message
This filter is use to modify ‘Upload media not allowed‘ warning message.
add_filter( 'rtmedia_upload_not_allowed_message', 'rtm_uploader_not_allowed_message', 10, 2);
function rtm_uploader_not_allowed_message( $msg, $uploader ) {
if ( 'uploader_widget' == $uploader ) {
$msg = 'You are not allowed to upload media from this widget.';
}
return $msg;
}
rtmedia_widget_show_public_media_only
By default gallery widget will only show media with public privacy. Use this filter to modify that behaviour. Retrun either true / false as per your requirement.
add_filter( 'rtmedia_widget_show_public_media_only', 'rtmedia_widget_modify_show_public_media_only', 10, 1);
function rtmedia_widget_modify_show_public_media_only( $show ) {
return false;
}
rtmedia_upload_tabs
This filter can be used to change the title of the select button in the rtMedia sidebad uploader.
For example:
add_filter('rtmedia_upload_tabs', 'function_to_rename_selector_button', 10, 1);
function function_to_rename_selector_button($tabs){
$tabs['file_upload']['default']['content'] = str_replace( 'value="Select"', 'value="Select the files"', $tabs['file_upload']['default']['content']);
return $tabs;
}
rtmedia_gallery_widget_ordering
This filter will change the order of the tabs displays in the rtMedia sidebar gallery widget.
/**
* Change the order of the tabs in rtMedia sidebar gallery widgets.
*
* @since 1.3.5
*
* @param array $allowed Contain the media tab list that will be going to be display in the rtMedia sidebar widget gallery.
* @param array $widgetid Contain widget id.
*
* @return array Media tab list in custom order.W
*/
function tmp_rtm_rtmedia_gallery_widget_ordering_callback( $allowed, $widgetid = '' ) {
return array( 'all', 'music', 'video' , 'photo' );
}
add_filter( 'rtmedia_gallery_widget_ordering', 'tmp_rtm_rtmedia_gallery_widget_ordering_callback', 10, 2 );
rtmedia_sidebar_widget_media_type_all_tab
This filter can alter the media types that are being displayed inside the All
tab of the rtMedia sidebar widget.
/**
* Will change the media type that are being allow inside the all tab of rtMedia sidebar widget.
*
* @since 1.3.5
*
* @param array $allow_media_type Media type that are being allow.
* @param array $widgetid Contain widget id.
*
* @return array $allow_media_type Media type that is being allowed.
*/
function tmp_rtmedia_sidebar_widget_media_type_all_tab_callback( $allow_media_type, $widgetid = '' ) {
/**
* Here Media type photo and video are allow to show.
* To add another music to it. Please use code like this example: `return $allow_media_type = array( 'photo', 'video', 'music' );`
*/
return $allow_media_type = array( 'photo', 'video' );
}
add_filter( 'rtmedia_sidebar_widget_media_type_all_tab', 'tmp_rtmedia_sidebar_widget_media_type_all_tab_callback', 10, 2 );