tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Main Menu', 'foodylite' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'gallery', 'video', 'audio' ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'foodylite_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // enable feature custom header add_theme_support( 'custom-header' ); // woocommerce support add_theme_support( 'woocommerce' ); } endif; // foodylite_setup add_action( 'after_setup_theme', 'foodylite_setup' ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function foodylite_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'foodylite' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Top Bar Area for Social Icons', 'foodylite' ), 'id' => 'sidebar-top', 'description' => __( 'Move here the widget Social Links (FoodyLite) and delete the title Social Links. Each Social Links should have http://', 'foodylite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Column 1', 'foodylite' ), 'id' => 'footer-column-1', 'description' => __( 'Sidebar Footer Column 1', 'foodylite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Column 2', 'foodylite' ), 'id' => 'footer-column-2', 'description' => __( 'Sidebar Footer Column 2', 'foodylite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Column 3', 'foodylite' ), 'id' => 'footer-column-3', 'description' => __( 'Sidebar Footer Column 3', 'foodylite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Archives Sidebar', 'foodylite' ), 'id' => 'sidebar-2', 'description' => __( 'It shows up only on archives page like Categories and Tags', 'foodylite' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'foodylite_widgets_init' ); /** * Custom Editor Style * */ function foodylite_add_editor_styles() { add_editor_style( 'editor-style.css' ); } add_action( 'init', 'foodylite_add_editor_styles' ); /** * Enqueue scripts and styles. */ function foodylite_scripts() { wp_enqueue_style( 'foodylite-style', get_stylesheet_uri() ); wp_style_add_data( 'foodylite-style', 'rtl', 'replace' ); wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome.css' ); wp_enqueue_script( 'jquery-imageloaded', get_template_directory_uri() . '/js/imagesloaded.pkgd.js', array('jquery'), '4.1.3', true ); wp_enqueue_script( 'jquery-retina', get_template_directory_uri() . '/js/retina.js', array('jquery'), '1.3.0', true ); wp_enqueue_script( 'foodylite-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20120206', true ); wp_enqueue_script( 'jquery-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'), '1.1.0', true ); wp_enqueue_script( 'foodylite-scripts', get_template_directory_uri() . '/js/scripts.js', array('jquery'), '20130115', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'foodylite_scripts' ); /** * Load dashboard */ require get_template_directory() . '/inc/dashboard/class-hs-dashboard.php'; $dashboard = new Foodylite_Dashboard; /** * Add "pro" link to the customizer * */ require get_template_directory() . '/inc/customize-pro/class-customize.php'; /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * Load Widgets. */ require get_template_directory() . '/inc/widgets.php'; /** * Include the TGM_Plugin_Activation class. */ require get_template_directory() . '/inc/class-tgm-plugin-activation.php'; function foodylite_register_required_plugins() { $plugins = array( array( 'name' => 'WP Recipe Maker', 'slug' => 'wp-recipe-maker', 'required' => false, ), array( 'name' => 'Contact Form 7', 'slug' => 'contact-form-7', 'required' => false, ), array( 'name' => 'Jetpack', 'slug' => 'jetpack', 'required' => false, ), array( 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false, ), ); $config = array( 'id' => 'foodylite', 'default_path' => '', 'menu' => 'tgmpa-install-plugins', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', ); tgmpa( $plugins, $config ); } add_action( 'tgmpa_register', 'foodylite_register_required_plugins' ); /** * Add Google Fonts */ function foodylite_add_google_fonts() { wp_register_style('googleFonts', 'https://fonts.googleapis.com/css?family=Lato:400,700|Montserrat:300,300i,400,400i,700,700i|Cormorant+Garamond:400,400i,700,700i'); wp_enqueue_style( 'foodylite-googleFonts'); } add_action('wp_print_styles', 'foodylite_add_google_fonts'); /** * Tag Cloud Sizes */ function foodylite_set_tag_cloud_sizes($args) { $args['smallest'] = 8; $args['largest'] = 18; return $args; } add_filter('widget_tag_cloud_args','foodylite_set_tag_cloud_sizes'); /** * Add to scroll top */ function foodylite_scroll_to_top() { ?> ' . __( 'Continue Reading', 'foodylite' ) . ''); } add_filter( 'excerpt_more', 'foodylite_excerpt_more' ); /** * Woocommerce: Change number or products per row to 3 */ if (!function_exists('foodylite_loop_columns')) { function foodylite_loop_columns() { return 3; // 3 products per row } } add_filter('loop_shop_columns', 'foodylite_loop_columns'); /** * Woocommerce: Change number of related products on product page */ function foodylite_woo_related_products_limit() { global $product; $args['posts_per_page'] = 3; return $args; } add_filter( 'woocommerce_output_related_products_args', 'foodylite_related_products_args' ); function foodylite_related_products_args( $args ) { $args['posts_per_page'] = 3; // 4 related products $args['columns'] = 3; // arranged in 2 columns return $args; } /** * WooCommerce Gallery */ function foodylite_woo_gallery() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } add_action( 'after_setup_theme', 'foodylite_woo_gallery' ); /** * Posts per page on Archive Page */ function foodylite_archive_posts( $query ) { if ( $query->is_archive() && $query->is_main_query() && !is_admin() ) { $query->set( 'posts_per_page', 60 ); } } add_action( 'pre_get_posts', 'foodylite_archive_posts' );