?php /** * Gen5. * * This file adds functions to the Genesis Sample Theme. * * @package Genesis Sample * @author StudioPress * @license GPL-2.0-or-later * @link https://www.studiopress.com/ */ // Starts the engine. require_once get_template_directory() . '/lib/init.php'; // Sets up the Theme. require_once get_stylesheet_directory() . '/lib/theme-defaults.php'; add_action( 'after_setup_theme', 'genesis_sample_localization_setup' ); /** * Sets localization (do not remove). * * @since 1.0.0 */ function genesis_sample_localization_setup() { load_child_theme_textdomain( genesis_get_theme_handle(), get_stylesheet_directory() . '/languages' ); } // Adds helper functions. require_once get_stylesheet_directory() . '/lib/helper-functions.php'; // Adds image upload and color select to Customizer. require_once get_stylesheet_directory() . '/lib/customize.php'; // Includes Customizer CSS. require_once get_stylesheet_directory() . '/lib/output.php'; // Adds WooCommerce support. require_once get_stylesheet_directory() . '/lib/woocommerce/woocommerce-setup.php'; // Adds the required WooCommerce styles and Customizer CSS. require_once get_stylesheet_directory() . '/lib/woocommerce/woocommerce-output.php'; // Adds the Genesis Connect WooCommerce notice. require_once get_stylesheet_directory() . '/lib/woocommerce/woocommerce-notice.php'; add_action( 'after_setup_theme', 'genesis_child_gutenberg_support' ); /** * Adds Gutenberg opt-in features and styling. * * @since 2.7.0 */ function genesis_child_gutenberg_support() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- using same in all child themes to allow action to be unhooked. require_once get_stylesheet_directory() . '/lib/gutenberg/init.php'; } // Registers the responsive menus. if ( function_exists( 'genesis_register_responsive_menus' ) ) { genesis_register_responsive_menus( genesis_get_config( 'responsive-menus' ) ); } add_action( 'wp_enqueue_scripts', 'genesis_sample_enqueue_scripts_styles' ); /** * Enqueues scripts and styles. * * @since 1.0.0 */ function genesis_sample_enqueue_scripts_styles() { $appearance = genesis_get_config( 'appearance' ); wp_enqueue_style( genesis_get_theme_handle() . '-fonts', $appearance['fonts-url'], [], genesis_get_theme_version() ); wp_enqueue_style( 'dashicons' ); if ( genesis_is_amp() ) { wp_enqueue_style( genesis_get_theme_handle() . '-amp', get_stylesheet_directory_uri() . '/lib/amp/amp.css', [ genesis_get_theme_handle() ], genesis_get_theme_version() ); } } add_action( 'after_setup_theme', 'genesis_sample_theme_support', 9 ); /** * Add desired theme supports. * * See config file at `config/theme-supports.php`. * * @since 3.0.0 */ function genesis_sample_theme_support() { $theme_supports = genesis_get_config( 'theme-supports' ); foreach ( $theme_supports as $feature => $args ) { add_theme_support( $feature, $args ); } } add_action( 'after_setup_theme', 'genesis_sample_post_type_support', 9 ); /** * Add desired post type supports. * * See config file at `config/post-type-supports.php`. * * @since 3.0.0 */ function genesis_sample_post_type_support() { $post_type_supports = genesis_get_config( 'post-type-supports' ); foreach ( $post_type_supports as $post_type => $args ) { add_post_type_support( $post_type, $args ); } } // Adds image sizes. add_image_size( 'sidebar-featured', 75, 75, true ); add_image_size( 'genesis-singular-images', 702, 526, true ); // Removes header right widget area. unregister_sidebar( 'header-right' ); // Removes secondary sidebar. unregister_sidebar( 'sidebar-alt' ); // Removes site layouts. genesis_unregister_layout( 'content-sidebar-sidebar' ); genesis_unregister_layout( 'sidebar-content-sidebar' ); genesis_unregister_layout( 'sidebar-sidebar-content' ); /* Repositions primary navigation menu. remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_header', 'genesis_do_nav', 12 ); */ // Repositions the secondary navigation menu. remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_footer', 'genesis_do_subnav', 10 ); add_filter( 'wp_nav_menu_args', 'genesis_sample_secondary_menu_args' ); /** * Reduces secondary navigation menu to one level depth. * * @since 2.2.3 * * @param array $args Original menu options. * @return array Menu options with depth set to 1. */ function genesis_sample_secondary_menu_args( $args ) { if ( 'secondary' === $args['theme_location'] ) { $args['depth'] = 1; } return $args; } add_filter( 'genesis_author_box_gravatar_size', 'genesis_sample_author_box_gravatar' ); /** * Modifies size of the Gravatar in the author box. * * @since 2.2.3 * * @param int $size Original icon size. * @return int Modified icon size. */ function genesis_sample_author_box_gravatar( $size ) { return 90; } add_filter( 'genesis_comment_list_args', 'genesis_sample_comments_gravatar' ); /** * Modifies size of the Gravatar in the entry comments. * * @since 2.2.3 * * @param array $args Gravatar settings. * @return array Gravatar settings with modified size. */ function genesis_sample_comments_gravatar( $args ) { $args['avatar_size'] = 60; return $args; } //* Add extra class to title-area add_filter( 'genesis_attr_title-area', 'genesis_sample_add_class_to_title_area' ); function genesis_sample_add_class_to_title_area( $attributes ) { $attributes['class'] = $attributes['class']. ' one-third first'; return $attributes; } // Register header cta widgets genesis_register_sidebar( array( 'id' => 'genesis-sample-header-middle', 'name' => __( 'Header - Middle ' ), 'description' => __( 'This is the widget area for the Header - Middle area in the header.' ), ) ); genesis_register_sidebar( array( 'id' => 'genesis-sample-header-right', 'name' => __( 'Header - Right ' ), 'description' => __( 'This is the widget area for the Header - Right area in the header.' ), ) ); //* Header CTA widgets output add_action( 'genesis_header', 'genesis_sample_header_widgets', 10 ); function genesis_sample_header_widgets() { genesis_widget_area ('genesis-sample-header-middle', array( 'before' => '', ) ); genesis_widget_area ('genesis-sample-header-right', array( 'before' => '', ) ); } Heating and Air Conditioning Repair