Beispiel #1
0
/**
 * Remove custom-background class from the array of body classes.
 */
function hovercraft_remove_body_class($classes)
{
    // Remove the custom background when the page slider is displayed.
    if (is_page_template('template-parts/page-slider.php') && hovercraft_has_featured_posts(2)) {
        foreach ($classes as $key => $value) {
            if ($value == 'custom-background') {
                unset($classes[$key]);
            }
        }
    }
    return $classes;
}
Beispiel #2
0
/**
 * Enqueue scripts and styles.
 */
function hovercraft_scripts()
{
    // Add custom fonts, used in the main stylesheet.
    wp_enqueue_style('hovercraft-fonts', hovercraft_fonts_url(), array(), null);
    // Add Genericons, used in the main stylesheet.
    wp_enqueue_style('genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.3.1');
    // Load the theme main stylesheet.
    wp_enqueue_style('hovercraft-style', get_stylesheet_uri(), array(), '2');
    wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.js', array(), '3.3.1', false);
    wp_enqueue_script('html5shiv', get_template_directory_uri() . '/js/html5shiv-printshiv.js', array(), '3.7.3', false);
    wp_script_add_data('html5shiv', 'conditional', 'lt IE 9');
    // Load the theme custom script file.
    wp_enqueue_script('hovercraft-script', get_template_directory_uri() . '/js/hovercraft.js', array('jquery'), '20150720', true);
    wp_enqueue_script('hovercraft-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true);
    wp_enqueue_script('hovercraft-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    // Only load the Flexslider script file on slider pages and when there are more than two featured posts.
    if (is_page_template('template-parts/page-slider.php') && hovercraft_has_featured_posts(2)) {
        wp_enqueue_script('hovercraft-slider-script', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'));
    }
}