Last active
March 22, 2017 07:20
-
-
Save raftaar1191/ee375c688a542698d48285006b85d5e2 to your computer and use it in GitHub Desktop.
Add a link below every media in media gallery
This file contains hidden or 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 | |
/** | |
* Add a link below every media in media gallery. | |
*/ | |
function tmp_rtmedia_rtmedia_after_item_callback() { | |
global $rtmedia_media; | |
// Check if $rtmedia_media->id rtMedia id is set and also check for if $rtmedia_media->media_id post id is set | |
if ( isset( $rtmedia_media->id ) && isset( $rtmedia_media->media_id ) ) { | |
// rtMedia id. | |
$media_id = $rtmedia_media->id; | |
// Post id. | |
$post_id = $rtmedia_media->media_id; | |
?> | |
<a href="http://demo.rtmedia.io/" class="no-popup media-id-<?php echo intval( $media_id ); ?> post-id-<?php echo intval( $post_id ); ?>">Buy Now</a> | |
<?php | |
} | |
} | |
add_action( 'rtmedia_after_item', 'tmp_rtmedia_rtmedia_after_item_callback', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment