Full screen Video Backgroud shortcode on hompage only
-
I know I can have a single video playing using the default settings of TwentySeventeen but I want to use multiple video clips to speed up loading (so the first one is very small). So I have purchased a plugin which inludes a video carousel, Universal Video Player.
The shortcode is:
Page/Post: [universal_video_player_and_bg settings_id=’5′]
For header.php: <?php echo do_shortcode(“[universal_video_player_and_bg settings_id=’5′]”);?>I have copied the header.php file to my child theme and I know I need some conditional logic to run the shortcode if the page is the homepage but skip this shortcode for all other pages. I have added the code below and while it now only dispplays the video background on the homepage, the navigation menu has dissapeared from all other pages. Is this something that should be done through custom CSS instead?
Regards
Paul<?php if ( ! is_front_page() || get_query_var( 'paged' ) >= 2 ) return; echo do_shortcode("[universal_video_player_and_bg settings_id='5']");?>
So this is the body of the header.php file
<body <?php body_class(); ?>> <?php wp_body_open(); ?> <div id="page" class="site"> <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentyseventeen' ); ?></a> <header id="masthead" class="site-header"> <?php if ( ! is_front_page() || get_query_var( 'paged' ) >= 2 ) return; echo do_shortcode("[universal_video_player_and_bg settings_id='5']");?> else { <?php get_template_part( 'template-parts/header/header', 'image' ); ?> <?php if ( has_nav_menu( 'top' ) ) : ?> <div class="navigation-top"> <div class="wrap"> <?php get_template_part( 'template-parts/navigation/navigation', 'top' ); ?> </div><!-- .wrap --> </div><!-- .navigation-top --> <?php endif; ?> </header><!-- #masthead --> <?php /* * If a regular post or page, and not the front page, show the featured image. * Using get_queried_object_id() here since the $post global may not be set before a call to the_post(). */ if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) : echo '<div class="single-featured-image-header">'; echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' ); echo '</div><!-- .single-featured-image-header -->'; endif; ?> } <div class="site-content-contain"> <div id="content" class="site-content">
The page I need help with: [log in to see the link]
- The topic ‘Full screen Video Backgroud shortcode on hompage only’ is closed to new replies.