Site icon Anthony Carbon

Override rtMedia media-gallery.php template into current WordPress theme

Override rtMedia media-gallery.php template into current WordPress theme is now not a problem. For example you have artist role in your users and you want different template for the artist role. This apply in `http://www.sample.com/members/artist/media/music/` page.

add_filter( 'rtmedia_template_filter', 'rtmedia_template_filter_override', 10, 3 );
function rtmedia_template_filter_override( $template ){
	global $bp;
 	$role = get_user_meta( $bp->displayed_user->id, 'wp_capabilities', true );
	if( $role['artists'] ) :
		$template = 'media-gallery-artist';
	endif;
	return $template;
}

Then create a folder inside the `/public_html/wp-content/themes/current-theme/rtmedia/media`.

Create your `media-gallery-artist.php` file or simple clone the `media-gallery.php` and renamed it into `media-gallery-artist.php` inside media folder.

For more concern about this post, just drop a comment below.

Exit mobile version