예제 #1
0
/**
 * Enqueue theme assets.
 *
 * @since 1.0.0
 */
function utility_pro_enqueue_assets()
{
    // Replace style.css with style-rtl.css for RTL languages
    //wp_style_add_data( 'utility-pro', 'rtl', 'replace' );
    // Load mobile responsive menu
    /*	wp_enqueue_script( 'utility-pro-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), null, true );
    
    	$localize = array(
    		'buttonText'     => __( 'Menu', 'utility-pro' ),
    		'buttonLabel'    => __( 'Primary Navigation Menu', 'utility-pro' ),
    		'subButtonText'  => __( 'Menu', 'utility-pro' ),
    		'subButtonLabel' => __( 'Sub Navigation Menu', 'utility-pro' ),
    	);
    
    	// Localize the responsive menu script (for translation)
    	wp_localize_script( 'utility-pro-responsive-menu', 'utilityResponsiveL10n', $localize );
    
    	// Keyboard navigation (dropdown menus) script
    	wp_enqueue_script( 'genwpacc-dropdown',  get_stylesheet_directory_uri() . '/js/genwpacc-dropdown.js', array( 'jquery' ), null , true ); 
    */
    // Load skiplink scripts only if Genesis Accessible plugin is not active
    if (!utility_pro_genesis_accessible_is_active()) {
        wp_enqueue_script('genwpacc-skiplinks-js', get_stylesheet_directory_uri() . '/js/genwpacc-skiplinks.js', array(), null, true);
    }
    // Load remaining scripts only if custom background is being used
    // and we're on the home page or a page using the landing page template
    if (!get_background_image() || !(is_front_page() || is_page_template() || is_single() || is_archive())) {
        return;
    }
    wp_enqueue_script('utility-pro-backstretch', get_stylesheet_directory_uri() . '/js/backstretch.min.js', array('jquery'), null, true);
    wp_enqueue_script('utility-pro-backstretch-args', get_stylesheet_directory_uri() . '/js/backstretch.args.js', array('utility-pro-backstretch'), null, true);
    wp_localize_script('utility-pro-backstretch-args', 'utilityBackstretchL10n', array('src' => secondaryimageheader()));
}
예제 #2
0
/**
 * Theme setup.
 *
 * Attach all of the site-wide functions to the correct hooks and filters. All
 * the functions themselves are defined below this setup function.
 *
 * @since 1.0.0
 */
function utility_pro_setup()
{
    define('CHILD_THEME_NAME', 'utility-pro');
    define('CHILD_THEME_URL', 'https://store.carriedils.com/utility-pro');
    define('CHILD_THEME_VERSION', '1.0.0');
    // Add HTML5 markup structure
    add_theme_support('html5', array('caption', 'comment-form', 'comment-list', 'gallery', 'search-form'));
    // Add viewport meta tag for mobile browsers
    add_theme_support('genesis-responsive-viewport');
    // Add support for custom background
    add_theme_support('custom-background', array('wp-head-callback' => '__return_false'));
    // Add support for three footer widget areas
    add_theme_support('genesis-footer-widgets', 3);
    // Add support for additional color style options
    add_theme_support('genesis-style-selector', array('utility-pro-purple' => __('Purple', 'utility-pro'), 'utility-pro-green' => __('Green', 'utility-pro'), 'utility-pro-red' => __('Red', 'utility-pro')));
    // Add support for structural wraps (all default Genesis wraps unless noted)
    add_theme_support('genesis-structural-wraps', array('footer', 'footer-widgets', 'header', 'home-gallery', 'nav', 'site-inner', 'site-tagline'));
    // Add support for two navigation areas (theme doesn't use secondary navigation)
    add_theme_support('genesis-menus', array('primary' => __('Primary Navigation Menu', 'utility-pro')));
    // Add custom image sizes
    add_image_size('feature-large', 960, 330, array('center', 'center'));
    add_image_size('feature-post', 1144);
    add_image_size('feature-post-archive', 743, 458, array('center', 'center'));
    add_image_size('feature-post-home', 360, 223, array('center', 'center', true));
    add_image_size('feature-rss', 564);
    add_image_size('yarpp-thumbnail', 360, 223, array('center', 'center', true));
    // Unregister secondary sidebar
    unregister_sidebar('sidebar-alt');
    // Unregister layouts that use secondary sidebar
    genesis_unregister_layout('content-sidebar-sidebar');
    genesis_unregister_layout('sidebar-content-sidebar');
    genesis_unregister_layout('sidebar-sidebar-content');
    // Register the default widget areas
    utility_pro_register_widget_areas();
    // Add Utility Bar above header
    add_action('genesis_before_header', 'utility_pro_add_bar');
    // Add featured image above posts
    // Add a navigation area above the site footer
    add_action('genesis_before_footer', 'utility_pro_do_footer_nav');
    // Remove Genesis archive pagination (Genesis pagination settings still apply)
    remove_action('genesis_after_endwhile', 'genesis_posts_nav');
    // Add WordPress archive pagination (accessibility)
    // Load accesibility components if the Genesis Accessible plugin is not active
    if (!utility_pro_genesis_accessible_is_active()) {
        // Load skip links (accessibility)
        include get_stylesheet_directory() . '/includes/skip-links.php';
    }
    // Apply search form enhancements (accessibility)
    add_filter('get_search_form', 'utility_pro_get_search_form', 25);
    // Load files in admin
    if (is_admin()) {
        // Add suggested plugins nag
        include get_stylesheet_directory() . '/includes/suggested-plugins.php';
        // Add theme license (don't remove, unless you don't want theme support)
        include get_stylesheet_directory() . '/includes/theme-license.php';
    }
}