Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
Created July 17, 2020 15:37
Show Gist options
  • Select an option

  • Save farookibrahim/81d81535b60ec3f205bcf9d72a9dad72 to your computer and use it in GitHub Desktop.

Select an option

Save farookibrahim/81d81535b60ec3f205bcf9d72a9dad72 to your computer and use it in GitHub Desktop.
Vodi - Add Play Trailer button in Movie v1
if ( ! function_exists( 'vodi_template_single_movie_v1_play_trailer_button' ) ) {
function vodi_template_single_movie_v1_play_trailer_button() {
global $movie;
$movie_id = $movie->get_ID();
$trailer_button_text = get_post_meta( $movie_id, '_vodi_movie_play_trailer_text', true );
$trailer_button_link = get_post_meta( $movie_id, '_vodi_movie_play_trailer_link', true );
if ( ! empty( $trailer_button_text ) && ! empty( $trailer_button_link ) ) : ?>
<div class="single-movie__actions">
<a href="<?php echo esc_url( $trailer_button_link ); ?>" class="movie-actions--play-trailers" tabindex="0" target="_blank">
<?php echo esc_html( $trailer_button_text ); ?>
</a>
</div>
<?php endif;
}
}
if ( ! function_exists( 'vodi_toggle_single_movie_v6_hooks' ) ) {
function vodi_toggle_single_movie_v6_hooks() {
if ( vodi_get_single_movie_style() == 'v1' ) {
add_action( 'masvideos_single_movie_summary', 'vodi_template_single_movie_v1_play_trailer_button', 35 );
}
}
}
add_action( 'masvideos_before_single_movie', 'vodi_toggle_single_movie_v6_hooks', 20 );
.single-movie-v1 .movie__rating-with-playlist .single-movie__actions {
margin-right: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment