Skip to content

Instantly share code, notes, and snippets.

@danielpataki
Last active March 20, 2017 17:29
Show Gist options
  • Save danielpataki/64f7102bc27871f105161ff8f6d5ff29 to your computer and use it in GitHub Desktop.
Save danielpataki/64f7102bc27871f105161ff8f6d5ff29 to your computer and use it in GitHub Desktop.
Customizing Video Headers
add_theme_support( 'custom-header', array(
'video' => true
));
<button type="button" id="wp-custom-header-video-button" class="wp-custom-header-video-button wp-custom-header-video-play">Pause</button>
<button type="button" id="wp-custom-header-video-button" class="wp-custom-header-video-button wp-custom-header-video-pause">Play</button>
add_theme_support( 'custom-header', array(
'video' => true,
'video-active-callback' => 'custom_video_active_callback'
));
function custom_video_active_callback() {
if( !is_user_logged_in() && !is_home() ) {
return true;
}
return false;
}
add_filter( 'header_video_settings', 'my_header_video_settings');
function my_header_video_settings( $settings ) {
$settings['minWidth'] = 680;
$settings['minHeight'] = 400;
return $settings;
}
add_filter( 'is_header_video_active', 'custom_video_header_pages' );
function custom_video_header_pages( $active ) {
if( is_home() || is_page() ) {
return true;
}
return false;
}
add_filter( 'header_video_settings', 'my_header_video_settings');
function my_header_video_settings( $settings ) {
$settings['l10n'] = array(
'pause' => __( 'Pause It' ),
'play' => __( 'Play It' ),
'pauseSpeak' => __( 'Video stopped.'),
'playSpeak' => __( 'Video started.'),
);
return $settings;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment