From 31d791d1476d263063b7b649a2d68b5a2f298ca0 Mon Sep 17 00:00:00 2001 From: jschwalbe Date: Sun, 4 Dec 2016 21:31:25 -0500 Subject: [PATCH 1/3] Update mp-stacks-hooks.php Added support for custom URL for mobile devices. --- includes/misc-functions/mp-stacks-hooks.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/misc-functions/mp-stacks-hooks.php b/includes/misc-functions/mp-stacks-hooks.php index 2621983..277fd3e 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,23 @@ 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 = ''; + $brick_bg_video_source == 'custom' } + //If a background video has been entered if ( !empty( $foreign_video_url ) || !empty( $custom_video_url ) ){ @@ -52,7 +60,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 ) ){ From 8a734c4ffdae6c38e6ca5ec508911d5e15714ec0 Mon Sep 17 00:00:00 2001 From: jschwalbe Date: Sun, 4 Dec 2016 21:34:06 -0500 Subject: [PATCH 2/3] Update video-backgrounds.php Added support for mobile custom URL. --- .../video-backgrounds/video-backgrounds.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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'), From 99d3492410dbe1d66f09aeb764e69170025869c3 Mon Sep 17 00:00:00 2001 From: jschwalbe Date: Sun, 4 Dec 2016 21:37:33 -0500 Subject: [PATCH 3/3] Update mp-stacks-hooks.php Forgot semi-colon.. Added support for custom mobile URL. --- includes/misc-functions/mp-stacks-hooks.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/misc-functions/mp-stacks-hooks.php b/includes/misc-functions/mp-stacks-hooks.php index 277fd3e..1df5891 100755 --- a/includes/misc-functions/mp-stacks-hooks.php +++ b/includes/misc-functions/mp-stacks-hooks.php @@ -47,8 +47,7 @@ function mp_stacks_video_background( $html_output, $post_id ){ //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 = ''; - $brick_bg_video_source == 'custom' + $brick_bg_video_source == 'custom'; }