Skip to content

Instantly share code, notes, and snippets.

@yousufansa
Created October 27, 2020 15:54
Show Gist options
  • Select an option

  • Save yousufansa/21284eae98603f9261988e3c96e67980 to your computer and use it in GitHub Desktop.

Select an option

Save yousufansa/21284eae98603f9261988e3c96e67980 to your computer and use it in GitHub Desktop.
Vodi - Allow Scripts in Single Movie & Video Banners
if ( ! function_exists( 'vodi_template_single_movie_sidebar_banner' ) ) {
function vodi_template_single_movie_sidebar_banner() {
$banner_image_id = get_post_meta( get_the_ID(), '_vodi_movie_banner_image', true );
$banner_link = get_post_meta( get_the_ID(), '_vodi_movie_banner_link', true );
$banner_content = apply_filters( 'vodi_movie_banner_content', '' );
if( ! empty( $banner_image_id ) || ! empty( $banner_content ) ) {
?><div class="single-movie__sidebar--banner-image"><?php
if( ! empty( $banner_image_id ) ) {
if( ! empty( $banner_link ) ) {
?><a href="<?php echo esc_url( $banner_link ); ?>"><?php
echo wp_get_attachment_image( $banner_image_id, 'full' );
?></a><?php
} else {
echo wp_get_attachment_image( $banner_image_id, 'full' );
}
} else {
print_r( $banner_content );
}
?></div><?php
}
}
}
if ( ! function_exists( 'vodi_template_single_video_sidebar_banner' ) ) {
function vodi_template_single_video_sidebar_banner() {
$banner_image_id = get_post_meta( get_the_ID(), '_vodi_video_banner_image', true );
$banner_link = get_post_meta( get_the_ID(), '_vodi_video_banner_link', true );
$banner_content = apply_filters( 'vodi_video_banner_content', '' );
if( ! empty( $banner_image_id ) || ! empty( $banner_content ) ) {
?><div class="single-video__sidebar--banner-image"><?php
if( ! empty( $banner_image_id ) ) {
if( ! empty( $banner_link ) ) {
?><a href="<?php echo esc_url( $banner_link ); ?>"><?php
echo wp_get_attachment_image( $banner_image_id, 'full' );
?></a><?php
} else {
echo wp_get_attachment_image( $banner_image_id, 'full' );
}
} else {
print_r( $banner_content );
}
?></div><?php
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment