• Resolved Pewit

    (@pewit)


    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">
    • This topic was modified 1 year, 10 months ago by Pewit.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Pewit

    (@pewit)

    I think I have found the solution – by adding this to header.php

    <header id="masthead" class="site-header">
    <?php if( is_front_page() ): ?>
    <?php echo do_shortcode("[universal_video_player_and_bg settings_id='5']");?>
    <?php endif; ?>

    <snip>
    The video is now showing on the homepage only as background to the site identy but I need to increase the height of the video area to display it completely. However, if I just add padding below the site identity it affects all pages not just the homepage.

    • This reply was modified 1 year, 10 months ago by Pewit.
    Plugin Author Oliver Campion

    (@domainsupport)

    Hi,

    So the “Options for Twenty Seventeen” plugin is designed to allow you to make changes to the theme without modifying the theme.

    What you are doing here is directly editing the theme files so you will probably be better off getting support in the theme’s support forum as this issue is not related to our plugin.

    Oliver

    Thread Starter Pewit

    (@pewit)

    Hi Oliver
    Im aware of that but for maintenance issues and upgrading I’d rather have a solution that didn’t require editing the theme files.
    I wondered if there was a way to do it using Options for 2017 by using the shortcode widget in the header but I think I’d still have the difficulty of only wanting display the video on the front page rather than all pages.
    Also the two sliders recommended only support streaming video from Youtube/Vimeo but for faster loading, it’s better to host the files on my server as I understand it.
    It it worth looking for a different slider that supports video or and has a widget or create a widget for my existing video display or is that likely to be a dead end?

    Plugin Author Oliver Campion

    (@domainsupport)

    Right, I understand now.

    It is unlikely that you would be able to do what you want by adding a widget to the header widget area.

    The way we do this with the other sliders is by injecting the relevant slider shortcode by using the get_template_part_template-parts/header/site action hook.

    In theory we could do the same for the Universal Video Player plugin you mention but unfortunately we cannot discuss that in this forum because that plugin is a premium plugin and due to the WordPress forum guidelines we are not allowed to discuss premium plugins here.

    Furthermore, we would require access to that plugin in order to develop this functionality and as it is a premium plugin we cannot do that either.

    Sorry.

    Oliver

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Full screen Video Backgroud shortcode on hompage only’ is closed to new replies.