diff --git a/includes/metaboxes/video-backgrounds/video-backgrounds.php b/includes/metaboxes/video-backgrounds/video-backgrounds.php index de7ebec..c64c65a 100755 --- a/includes/metaboxes/video-backgrounds/video-backgrounds.php +++ b/includes/metaboxes/video-backgrounds/video-backgrounds.php @@ -63,6 +63,24 @@ function mp_stacks_video_backgrounds_additional_items_array( $items_array ) { 'field_conditional_values' => array( 'custom' ), 'field_showhider' => 'brick_bg_video_showhider' ), + 'mp_stacks_video_backgrounds_custom_mobile_option' => array( + 'field_id' => 'brick_bg_video_custom_mobile_option', + 'field_title' => __( 'Custom URL for Mobile?', 'mp_stacks'), + 'field_description' => 'Do you want to set a separate custom URL for mobile?' , + 'field_type' => 'checkbox', + 'field_value' => '', + 'field_showhider' => 'brick_bg_video_showhider' + ), + 'mp_stacks_video_backgrounds_custom_mobile_url' => array( + 'field_id' => 'brick_bg_video_custom_mobile_url', + 'field_title' => __( 'Background Video URL for Mobile', 'mp_stacks'), + 'field_description' => 'Upload/Enter the URL to the video', + 'field_type' => 'mediaupload', + 'field_value' => '', + 'field_conditional_id' => 'brick_bg_video_custom_mobile_option', + 'field_conditional_values' => array( 'true' ), + 'field_showhider' => 'brick_bg_video_showhider' + ), 'mp_stacks_video_backgrounds_color_overlay' => array( 'field_id' => 'brick_bg_video_color_overlay', 'field_title' => __( 'Color Overlay', 'mp_stacks'), diff --git a/includes/misc-functions/mp-stacks-hooks.php b/includes/misc-functions/mp-stacks-hooks.php index 2621983..1df5891 100755 --- a/includes/misc-functions/mp-stacks-hooks.php +++ b/includes/misc-functions/mp-stacks-hooks.php @@ -26,6 +26,7 @@ function mp_stacks_video_background( $html_output, $post_id ){ $brick_bg_video_source = mp_core_get_post_meta( $post_id, 'brick_bg_video_source' ); + $brick_bg_video_custom_mobile_option = mp_core_get_post_meta( $post_id, 'brick_bg_video_custom_mobile_option' ); $foreign_video_url = mp_core_get_post_meta( $post_id, 'brick_bg_video' ); $custom_video_url = mp_core_get_post_meta( $post_id, 'brick_bg_video_custom_url' ); @@ -34,16 +35,22 @@ function mp_stacks_video_background( $html_output, $post_id ){ $color_overlay = mp_core_get_post_meta( $post_id, 'brick_bg_video_color_overlay', 'none' ); $color_opacity = mp_core_get_post_meta( $post_id, 'brick_bg_video_color_opacity', 50 ); $color_opacity = $color_opacity / 100; + $custom_mobile_video_url = mp_core_get_post_meta( $post_id, 'brick_bg_video_custom_mobile_url' ); + //Convert to rgb from hex $color_overlay_rgb_array = $color_overlay != 'none' ? mp_core_hex2rgb($color_overlay) : NULL; - //If this is an iphone or ipad, we don't want to show any video background cause it can't handle it - if ( $brick_bg_video_source != 'custom' && ( mp_core_is_iphone() || mp_core_is_ipad() ) ){ - return false; + //If this is an iPhone or iPad and $brick_bg_video_custom_mobile_option is true and $custom_mobile_video_url is set + if ( $brick_bg_video_custom_mobile_option && !empty( $custom_mobile_video_url ) && ( mp_core_is_iphone() || mp_core_is_ipad() ) ){ + //Use the same functions for the normal circumstance, just change the variables + $custom_video_url = $custom_mobile_video_url; + $foreign_video_url = ''; + $brick_bg_video_source == 'custom'; } + //If a background video has been entered if ( !empty( $foreign_video_url ) || !empty( $custom_video_url ) ){ @@ -52,7 +59,6 @@ function mp_stacks_video_background( $html_output, $post_id ){ //Video Container div $html_output .= '
'; - //If a color overlay has been set if ( !empty( $color_overlay_rgb_array ) ){