Last active
April 17, 2017 07:04
-
-
Save rahul3883/e4f5e332478fb2d880142dfa7e968b20 to your computer and use it in GitHub Desktop.
Display album link on rtMedia's single media page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display album name with permalink. | |
* | |
* @param $media_id Current media id for which we need to display the album link. | |
*/ | |
function tmp_rtm_display_album_link( $media_id ) { | |
global $rt_ajax_request; | |
// Show only on full media page, not on media popup. | |
if ( empty( $rt_ajax_request ) && ! empty( $media_id ) ) { | |
global $rtmedia_media; | |
if ( $media_id === $rtmedia_media->id ) { | |
$rtm_album_name = rtmedia_album_name(); | |
if ( ! empty( $rtm_album_name ) ) { | |
?> | |
<div id="tmp-rtm-media-album-link" class="tmp-rtm-media-album-link"> | |
<span><?php esc_html_e( 'Album', 'rtmedia' ) ?>: </span> | |
<a href="<?php rtmedia_album_permalink(); ?>"><?php echo $rtm_album_name; ?></a> | |
</div> | |
<?php | |
} | |
} | |
} | |
} | |
add_action( 'rtmedia_actions_before_description', 'tmp_rtm_display_album_link', 8 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this code snippet in your theme's
functions.php
file.Note: This code snippet will show album link only on single media page, not on media popup.