/** * Custom amendments for the theme. * * @package FoodiePro * @copyright Copyright (c) 2017, Feast Design Co. * @license GPL-2.0+ * @since 1.0.1 */ defined( 'WPINC' ) || die; require_once trailingslashit( get_template_directory() ) . 'lib/init.php'; define( 'CHILD_THEME_NAME', 'Foodie Pro Theme' ); define( 'CHILD_THEME_VERSION', '3.1.0' ); define( 'CHILD_THEME_URL', 'https://feastdesignco.com/product/foodie-pro-2/' ); define( 'CHILD_THEME_DEVELOPER', 'Feast Design Co.' ); define( 'FOODIE_PRO_DIR', trailingslashit( get_stylesheet_directory() ) ); define( 'FOODIE_PRO_URI', trailingslashit( get_stylesheet_directory_uri() ) ); add_theme_support( 'genesis-responsive-viewport' ); add_theme_support( 'html5' ); add_theme_support( 'genesis-accessibility', array( 'headings', 'search-form', 'skip-links', ) ); add_theme_support( 'custom-header', array( 'width' => 640, 'height' => 340, 'header-selector' => '.site-title a', 'header-text' => false, ) ); add_theme_support( 'custom-background' ); add_theme_support( 'genesis-connect-woocommerce' ); add_theme_support( 'genesis-after-entry-widget-area' ); add_theme_support( 'genesis-footer-widgets', 4 ); genesis_register_sidebar( array( 'id' => 'before-header', 'name' => __( 'Before Header', 'foodiepro' ), 'description' => __( 'This is the section before the header.', 'foodiepro' ), ) ); genesis_register_sidebar( array( 'id' => 'home-top', 'name' => __( 'Home Top', 'foodiepro' ), 'description' => __( 'This is the home top section.', 'foodiepro' ), ) ); genesis_register_sidebar( array( 'id' => 'home-middle', 'name' => __( 'Home Middle', 'foodiepro' ), 'description' => __( 'This is the home middle section.', 'foodiepro' ), ) ); genesis_register_sidebar( array( 'id' => 'home-bottom', 'name' => __( 'Home Bottom', 'foodiepro' ), 'description' => __( 'This is the home bottom section.', 'foodiepro' ), ) ); genesis_register_sidebar( array( 'id' => 'recipes-top', 'name' => __( 'Recipes Top', 'foodiepro' ), 'description' => __( 'This is the recipes top section.', 'foodiepro' ), ) ); genesis_register_sidebar( array( 'id' => 'recipes-bottom', 'name' => __( 'Recipes Bottom', 'foodiepro' ), 'description' => __( 'This is the recipes bottom section.', 'foodiepro' ), ) ); genesis_register_sidebar( array( 'id' => 'nav-social-menu', 'name' => __( 'Nav Social Menu', 'foodiepro' ), 'description' => __( 'This is the nav social menu section.', 'foodiepro' ), ) ); require_once FOODIE_PRO_DIR . 'lib/helpers.php'; require_once FOODIE_PRO_DIR . 'lib/customize/init.php'; if ( is_admin() ) { require_once FOODIE_PRO_DIR . 'lib/admin/functions.php'; } add_action( 'after_setup_theme', 'foodie_pro_content_width', 0 ); /** * Set the content width and allow it to be filtered directly. * * @since 1.0.0 * @access public * @return void */ function foodie_pro_content_width() { $GLOBALS['content_width'] = apply_filters( 'foodie_pro_content_width', 610 ); } add_action( 'after_setup_theme', 'foodie_pro_load_textdomain' ); /** * Loads the child theme textdomain. * * @since 2.1.0 * @return void */ function foodie_pro_load_textdomain() { load_child_theme_textdomain( 'foodiepro', FOODIE_PRO_DIR . 'languages' ); } add_action( 'init', 'foodie_pro_register_image_sizes', 5 ); /** * Register custom image sizes for the theme. * * @since 1.0.0 * @access public * @return void */ function foodie_pro_register_image_sizes() { add_image_size( 'horizontal-thumbnail', 680, 450, true ); add_image_size( 'horizontal-thumbnail-small', 340, 225, true ); add_image_size( 'vertical-thumbnail', 680, 900, true ); add_image_size( 'vertical-thumbnail-small', 340, 450, true ); add_image_size( 'square-thumbnail', 320, 321, true ); } add_action( 'widgets_init', 'foodie_pro_register_widgets', 11 ); /** * Unregister the default Genesis Featured Posts widget and register all of * our custom Foodie Pro widgets. * * @since 2.0.0 */ function foodie_pro_register_widgets() { require_once FOODIE_PRO_DIR . 'lib/widgets/featured-posts/widget.php'; unregister_widget( 'Genesis_Featured_Post' ); register_widget( 'Foodie_Pro_Featured_Posts' ); } add_action( 'wp_enqueue_scripts', 'foodie_pro_enqueue_js' ); /** * Load all required JavaScript for the Foodie theme. * * @since 1.0.1 * @return void */ function foodie_pro_enqueue_js() { wp_enqueue_script( 'foodie-pro-general', FOODIE_PRO_URI . 'js/general.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); } add_filter( 'body_class', 'foodie_pro_add_body_class' ); /** * Add the theme name class to the body element. * * @since 1.0.0 * @param array $classes Current body classes. * @return array $classes Modified body classes. */ function foodie_pro_add_body_class( $classes ) { $classes[] = 'foodie-pro'; return $classes; } add_action( 'genesis_before', 'foodie_pro_before_header' ); /** * Load an ad section before .site-inner. * * @since 1.0.0 * @return void */ function foodie_pro_before_header() { genesis_widget_area( 'before-header', array( 'before' => '