tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'custom-logo', array( 'height' => 55, 'width' => 250, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ) ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); add_image_size( 'croccante-hover-post' , 860, 400, true); add_image_size( 'croccante-the-post' , 860, 99999); add_image_size( 'croccante-box-small', 70, 70, true); // Set the default content width. $GLOBALS['content_width'] = 800; // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'croccante-pro' ), ) ); /* * 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', ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /* Load Theme Updater */ require( get_template_directory() . '/updater/theme-updater.php' ); /* * Starter Content Support */ add_theme_support( 'starter-content', array( 'posts' => array( 'home' => array( 'template' => 'template-onepage.php', ), 'blog', ), 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', 'croccante_theme_options[_onepage_section_slider]' => '1', 'croccante_theme_options[_onepage_image_1_slider]' => get_template_directory_uri().'/images/example/croccante_slider_example_1.jpg', 'croccante_theme_options[_onepage_image_2_slider]' => get_template_directory_uri().'/images/example/croccante_slider_example_2.jpg', 'croccante_theme_options[_onepage_text_1_slider]' => 'Welcome to Croccante PRO Theme', 'croccante_theme_options[_onepage_subtext_1_slider]' => 'Use the customizer to customize the onepage sections', 'croccante_theme_options[_onepage_text_2_slider]' => 'Read the documentation', 'croccante_theme_options[_onepage_subtext_2_slider]' => 'You can find the documentation in "Appearance-> About Croccante PRO-> Documentation"', 'croccante_theme_options[_onepage_section_skills]' => '1', 'croccante_theme_options[_onepage_titleanimation_skills]' => 'crocanim', 'croccante_theme_options[_onepage_skillname_1_skills]' => 'Design', 'croccante_theme_options[_onepage_skillvalue_1_skills]' => '84', 'croccante_theme_options[_onepage_skillname_2_skills]' => 'WordPress', 'croccante_theme_options[_onepage_skillvalue_2_skills]' => '93', 'croccante_theme_options[_onepage_skillname_3_skills]' => 'SEO', 'croccante_theme_options[_onepage_skillvalue_3_skills]' => '76', 'croccante_theme_options[_onepage_skillname_4_skills]' => 'Support', 'croccante_theme_options[_onepage_skillvalue_4_skills]' => '90', 'croccante_theme_options[_onepage_skillname_5_skills]' => 'Customization', 'croccante_theme_options[_onepage_skillvalue_5_skills]' => '89', 'croccante_theme_options[_onepage_skillname_6_skills]' => 'Updates', 'croccante_theme_options[_onepage_skillvalue_6_skills]' => '87', 'croccante_theme_options[_onepage_section_cta]' => '1', 'croccante_theme_options[_onepage_phrase_cta]' => 'Do you like Croccante PRO Theme?', 'croccante_theme_options[_onepage_desc_cta]' => 'Good! Now take a look at our plugins...', 'croccante_theme_options[_onepage_textbutton_cta]' => 'CrestaProject Plugins', 'croccante_theme_options[_onepage_urlbutton_cta]' => 'https://crestaproject.com/plugins/', ), 'nav_menus' => array( 'menu-1' => array( 'name' => __( 'Primary', 'croccante-pro' ), 'items' => array( 'link_home', 'page_blog', ), ), ), ) ); } endif; add_action( 'after_setup_theme', 'croccantepro_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function croccantepro_content_width() { $content_width = $GLOBALS['content_width']; $sidebarPosition = croccante_options('_sidebar_position','sidebar-right'); if (function_exists( 'is_woocommerce' ) && is_shop()) { $theID = get_option( 'woocommerce_shop_page_id' ); $sidebarPositionSingle = get_post_meta( $theID, 'croccante-sidebar-select', true ); } if ( is_single() || is_page() ) { $sidebarPositionSingle = get_post_meta( get_the_ID(), 'croccante-sidebar-select', true ); } if (empty($sidebarPositionSingle) || $sidebarPositionSingle == 'default') { $sidebarPositionSingle = $sidebarPosition; } if ($sidebarPositionSingle == 'no-sidebar') { $content_width = 1170; } $GLOBALS['content_width'] = apply_filters( 'croccantepro_content_width', $content_width ); } add_action( 'template_redirect', 'croccantepro_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function croccantepro_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Classic Sidebar', 'croccante-pro' ), 'id' => 'sidebar-classic', 'description' => esc_html__( 'Add widgets here.', 'croccante-pro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Push Sidebar', 'croccante-pro' ), 'id' => 'sidebar-push', 'description' => esc_html__( 'Add widgets here.', 'croccante-pro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 1', 'croccante-pro' ), 'id' => 'footer-1', 'description' => esc_html__( 'Add widgets here.', 'croccante-pro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 2', 'croccante-pro' ), 'id' => 'footer-2', 'description' => esc_html__( 'Add widgets here.', 'croccante-pro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 3', 'croccante-pro' ), 'id' => 'footer-3', 'description' => esc_html__( 'Add widgets here.', 'croccante-pro' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'croccantepro_widgets_init' ); /** * Enqueue scripts and styles. */ function croccantepro_scripts() { wp_enqueue_style( 'croccante-pro-style', get_stylesheet_uri() ); if (is_page_template('template-onepage.php')) { wp_enqueue_style( 'croccante-pro-animate', get_template_directory_uri() .'/css/animate.min.css'); } wp_enqueue_style( 'font-awesome', get_template_directory_uri() .'/css/font-awesome.min.css'); $fontHeading = croccante_options('_font_heading','Playfair Display : serif'); $fontText = croccante_options('_font_text','Noto Sans : sans-serif'); $piecesHead = explode(" : ", esc_html($fontHeading)); $piecesText = explode(" : ", esc_html($fontText)); $fontNameHead = str_replace(" ", "+", $piecesHead[0]); $fontNameText = str_replace(" ", "+", $piecesText[0]); $query_args = array( 'family' => $fontNameText.':400,700%7C'. $fontNameHead .':400,700' ); wp_enqueue_style( 'croccante-pro-googlefonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null ); wp_enqueue_script( 'croccante-pro-custom', get_template_directory_uri() . '/js/jquery.croccantepro.js', array('jquery'), '1.0', true ); wp_enqueue_script( 'croccante-pro-main-js', get_template_directory_uri() . '/js/mainjs.min.js', array('jquery'), '1.0', true ); wp_enqueue_script( 'croccante-pro-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'croccante-pro-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( croccante_options('_smooth_scroll', '1') == 1) { wp_enqueue_script( 'croccante-pro-smooth-scroll', get_template_directory_uri() . '/js/SmoothScroll.min.js', array('jquery'), '1.0', true ); } if (is_page_template('template-onepage.php') && croccante_options('_onepage_section_slider', '') == 1) { wp_enqueue_script( 'croccante-pro-flex-slider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '1.0', true ); } if (is_page_template('template-onepage.php') && croccante_options('_onepage_section_map', '') == 1) { $googleMapKey = croccante_options('_onepage_key_map', ''); $query_args_map = array( 'key' => esc_attr(trim($googleMapKey)), 'v' => '3' ); wp_register_script( 'mise-googleMaps', add_query_arg( $query_args_map, "//maps.googleapis.com/maps/api/js" ), array('jquery'), '1.0', true ); wp_enqueue_script( 'mise-googleMaps' ); } if ( croccante_options('_power_tip', '') == 1) { wp_enqueue_script( 'croccante-pro-powerTip', get_template_directory_uri() . '/js/jquery.powertip.min.js', array('jquery'), '1.0', true ); } if ( croccante_options('_magnific_popup', '') == 1) { wp_enqueue_script( 'croccante-pro-lightcase', get_template_directory_uri() . '/js/lightcase.min.js', array('jquery'), '1.0', true ); } if ( croccante_options('_sticky_sidebar', '') == 1) { wp_enqueue_script( 'croccante-pro-sticky-sidebar', get_template_directory_uri() . '/js/theia-sticky-sidebar.min.js', array('jquery'), '1.0', true ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } /* Dequeue default WooCommerce Layout */ wp_dequeue_style ( 'woocommerce-layout' ); wp_dequeue_style ( 'woocommerce-smallscreen' ); wp_dequeue_style ( 'woocommerce-general' ); if ( croccante_options('_magnific_popup', '') == 1 ) { wp_dequeue_style ( 'woocommerce_prettyPhoto_css' ); wp_dequeue_script( 'prettyPhoto' ); wp_dequeue_script( 'prettyPhoto-init' ); } } add_action( 'wp_enqueue_scripts', 'croccantepro_scripts' ); /** * WooCommerce Support */ if ( ! function_exists( 'croccantepro_woocommerce_support' ) ) : function croccantepro_woocommerce_support() { add_theme_support( 'woocommerce' ); if ( croccante_options('_magnific_popup', '') != 1 ) { add_theme_support( 'wc-product-gallery-lightbox' ); } } add_action( 'after_setup_theme', 'croccantepro_woocommerce_support' ); endif; // croccante_woocommerce_support if ( function_exists( 'is_woocommerce' ) ) : /** * WooCommerce Ajax cart number */ add_filter( 'woocommerce_add_to_cart_fragments', 'croccantepro_cart_count_fragments', 10, 1 ); function croccantepro_cart_count_fragments( $fragments ) { $fragments['span.shopping-count'] = '' . WC()->cart->get_cart_contents_count() . ''; return $fragments; } /** * WooCommerce: Chenge default max number of related products to 3 */ add_filter( 'woocommerce_output_related_products_args', 'croccantepro_related_products_args' ); function croccantepro_related_products_args( $args ) { $args['posts_per_page'] = 3; return $args; } endif; /** * 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. */ require get_template_directory() . '/inc/jetpack.php'; /** * Metaboxes */ require get_template_directory() . '/inc/metaboxes.php'; /** * Portfolio Metaboxes */ if( function_exists( 'croccantepro_portfolio' )) { require get_template_directory() . '/inc/metaboxes-portfolio.php'; } /** * License button */ require_once( trailingslashit( get_template_directory() ) . 'inc/license-button/class-customize.php' ); /* Calling in the admin area for the Welcome Page */ if ( is_admin() ) { require get_template_directory() . '/inc/admin/croccantepro-admin-page.php'; } /** * Load Widget. */ include(get_template_directory() . '/inc/widgets/combo-widget.php'); include(get_template_directory() . '/inc/widgets/latest-comments.php'); include(get_template_directory() . '/inc/widgets/most-commented.php'); include(get_template_directory() . '/inc/widgets/most-viewed.php'); include(get_template_directory() . '/inc/widgets/news-pictures.php'); include(get_template_directory() . '/inc/widgets/random-post.php'); include(get_template_directory() . '/inc/widgets/recent-post.php'); include(get_template_directory() . '/inc/widgets/social-buttons.php'); include(get_template_directory() . '/inc/widgets/random-portfolio.php'); /** * TGM Plugin Activation */ require_once dirname( __FILE__ ) . '/inc/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'croccantepro_require_plugins' ); function croccantepro_require_plugins() { $plugins = array( array( 'name' => 'Croccante PRO Portfolio', 'slug' => 'croccante-portfolio', 'source' => crestaproject_change_https_to_http().'//crestaproject.com/themes-plugins/croccante-portfolio.zip', 'required' => false, 'version' => '1.0.0', 'force_activation' => false, 'force_deactivation' => true, 'external_url' => '', ), array( 'name' => 'Croccante PRO Shortcodes', 'slug' => 'croccante-shortcodes', 'source' => crestaproject_change_https_to_http().'//crestaproject.com/themes-plugins/croccante-shortcodes.zip', 'required' => false, 'version' => '1.0', 'force_activation' => false, 'force_deactivation' => true, 'external_url' => '', ), ); $config = array( 'id' => 'croccanteplug', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'croccanteplug-install-plugins', // Menu slug. 'parent_slug' => 'themes.php', // Parent menu slug. 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', ); tgmpa( $plugins, $config ); }