Filters

Descriptions

rtmedia_my_likes_media_page_title


Filter is use to modify My liked page page title.

add_filter( 'rtmedia_my_likes_media_page_title', 'rtm_my_likes_media_page_title', 10, 1 );

function rtm_my_likes_media_page_title ( $title ) {
    return 'Your likes';
}

rtmedia_user_likes_media_page_title


Filter is use to modify user’s liked page page title.

add_filter( 'rtmedia_user_likes_media_page_title', 'rtm_user_likes_media_page_title', 10, 1 );

function rtm_user_likes_media_page_title ( $title ) {
    return 'Friend likes';
}

rtmedia_query_where_filter_remove_comment_media


Filter is use to display comment media in rtMedia likes tab.

if ( ! function_exists( 'rtmedia_add_comment_media_in_media_tab' ) ) {
	/**
	 * Display comment media in rtMedia likes tab.
	 *
	 * @param boolean $value True to hide comment media False to show comment media.
	 * @param string $where Specifies where filter is being called.

	 * @return boolean True to hide comment media False to show comment media.
	 */
	function rtmedia_add_comment_media_in_media_tab( $value, $where = '' ) {
		// Check if $where equal to likes or else return the default value.
		if ( 'likes' == (string) $where  ) {
			// Return false we we want to show comment media in likes tab.
			return false;
		} else {
			return $value;
		}
	}
}
add_filter( 'rtmedia_query_where_filter_remove_comment_media', 'rtmedia_add_comment_media_in_media_tab', 10, 2 );

rtm_likes_js_strings


This filter is use to modify JS strings for rtMedia likes addon.

add_filter('rtm_likes_js_strings', 'rtmedia_likes_js_strings', 10, 1 );

function rtmedia_likes_js_strings( $rtmedia_like_main_js ) {
    $rtmedia_like_main_js ['rtmedia_media_who_liked']= 'Check who liked this media';
    return $rtmedia_like_main_js;
}

rtmedia_sub_nav_user_likes

If the user wants to add an icon in the “Likes” tab then this filter is the right choice.

/**
 * Add this function to theme's functions.php
 * Add icon to "Like" tab
 */
function rtmedia_custom_sub_nav_user_likes( $li_content ) {
    if ( class_exists( 'RTMedia' ) ) {
        global $rtmedia_query, $rtmedia_like_page;
        $selected = '';

        if ( ( isset( $rtmedia_query->action_query->media_type ) && 'likes' == $rtmedia_query->action_query->media_type ) || ( isset( $rtmedia_like_page ) && $rtmedia_like_page ) ) {
            $selected = ' class="current selected"';
        }
        $context      = isset( $rtmedia_query->query['context'] ) ? $rtmedia_query->query['context'] : 'default';
        $context_id   = isset( $rtmedia_query->query['context_id'] ) ? $rtmedia_query->query['context_id'] : 0;
        $profile_link = trailingslashit( get_rtmedia_user_link( $rtmedia_query->query['context_id'] ) );
        $li_content = '<li id="rtmedia-nav-item-user-likes-' . $context . '-' . $context_id . '-li" ' . $selected . '><a id="rtmedia-nav-item-user-likes" href="' . $profile_link . RTMEDIA_MEDIA_SLUG . '/' . constant( 'RTMEDIA_USER_LIKES_SLUG' ) . '/"><img src="http://forumserver.twoplustwo.com/images/smilies/heart.gif" /> ' . ucfirst( constant( 'RTMEDIA_USER_LIKES_PLURAL_LABEL' ) ) . '</a></li>';
    }
    return $li_content;
}
 add_filter( 'rtmedia_sub_nav_user_likes', 'rtmedia_custom_sub_nav_user_likes' ); 

The likes tab will look like this after adding the above code to your theme’s functions.php file:

rtmedia_check_enable_disable_like


If the user does not want media like feature then this filter will help to disable it.

function rtmedia_disable_like( $enable_like ) {
    $enable_like = false;
    return $enable_like;
}
add_filter( 'rtmedia_check_enable_disable_like', 'rtmedia_disable_like', 10, 1 );