esc_html__('Primary', 'atomy'), )); // Switch default core markup for search form, comment form, and comments add_theme_support('html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', )); // Support for background Image add_theme_support('custom-background', apply_filters('atomy_custom_background_args', array( 'default-color' => 'eaeaea', 'default-image' => '', ))); // Support for Video add_theme_support('custom-header', array( 'video' => true, )); // Add support for Responsive Video add_theme_support("responsive-embeds"); // Support Block Style add_theme_support('wp-block-styles'); // Support Custom Palette add_theme_support('editor-color-palette', array( array( 'name' => esc_attr__('atomy', 'atomy'), 'slug' => 'atomy', 'color' => '#82B541', ), array( 'name' => esc_attr__('red', 'atomy'), 'slug' => 'red', 'color' => '#f40101', ), )); // Support full image add_theme_support('align-wide'); // Add theme support for selective refresh for widgets. add_theme_support('customize-selective-refresh-widgets'); // Add support for core custom logo. add_theme_support('custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, )); } endif; add_action('after_setup_theme', 'atomy_setup'); /* Layout ========================================================================== */ function atomy_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters('atomy_content_width', 640); } add_action('after_setup_theme', 'atomy_content_width', 0); /* Widget Area ========================================================================== */ function atomy_widgets_init() { // Widget primary Sidebar register_sidebar(array( 'name' => esc_html__('Blocks Sidebar Blog', 'atomy'), 'id' => 'sidebar-1', 'description' => esc_html__('Add blocks here.', 'atomy'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Widget Card With Sidebar Section register_sidebar(array( 'name' => esc_html__('Blocks Card With Sidebar Section/Sidebar Store', 'atomy'), 'id' => 'sidebar-3', 'description' => esc_html__('Add blocks here.', 'atomy'), 'before_widget' => '', 'before_title' => '', )); // Widget Contact Header register_sidebar(array( 'name' => esc_html__('Blocks Contact Header', 'atomy'), 'id' => 'sidebar-8', 'description' => esc_html__('Add blocks here.', 'atomy'), 'before_widget' => '', 'before_title' => '', )); // Widget Contact register_sidebar(array( 'name' => esc_html__('Blocks Contact Body', 'atomy'), 'id' => 'sidebar-9', 'description' => esc_html__('Add blocks here.', 'atomy'), 'before_widget' => '', 'before_title' => '', )); // Widget Contact Sidebar register_sidebar(array( 'name' => esc_html__('Blocks Contact Sidebar', 'atomy'), 'id' => 'sidebar-10', 'description' => esc_html__('Add blocks here.', 'atomy'), 'before_widget' => '', 'before_title' => '', )); // Widget Services One register_sidebar(array( 'name' => esc_html__('Blocks Services One', 'atomy'), 'id' => 'sidebar-15', 'description' => esc_html__('Enter a Block', 'atomy'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Widget Services Two register_sidebar(array( 'name' => esc_html__('Blocks Services Two', 'atomy'), 'id' => 'sidebar-16', 'description' => esc_html__('Enter a Block', 'atomy'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Widget Services Three register_sidebar(array( 'name' => esc_html__('Blocks Services Three', 'atomy'), 'id' => 'sidebar-17', 'description' => esc_html__('Enter a Block', 'atomy'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // Widget Block Header register_sidebar( array( 'name' => esc_html__('BubiBlock Slider Header. To activate the Slider you need to install the BubiBlock Slider Plugin!', 'atomy'), 'id' => 'widget_block_header_atomy', 'before_title' => '

', 'after_title' => '

', 'before_widget' => '
', 'after_widget' => '
', ) ); } add_action('widgets_init', 'atomy_widgets_init'); /* Enqueue scripts and styles ========================================================================== */ function atomy_scripts() { // Style wp_enqueue_style('atomy-style', get_stylesheet_uri()); // Bootstrap wp_enqueue_script('popper-js', get_template_directory_uri() . '/js/popper.min.js', array('jquery'), 'v1.14.3', true); wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), 'v4.3.1', true); wp_enqueue_style('bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css'); // Font Awesome wp_enqueue_style('font-awesome-css', get_template_directory_uri() . '/css/fontawesome-all.min.css'); // AOS Animate wp_enqueue_script('aos-js', get_template_directory_uri() . '/js/aos.min.js', array(), '2.0.0', false); wp_enqueue_style('aos-css', get_template_directory_uri() . '/css/aos.min.css'); // Atom Script wp_enqueue_script('atomy-custom-script-js', get_template_directory_uri() . '/js/atomy-custom-script.js', array(), 'v1.0.5', true); wp_enqueue_script('skip-link-focus-fix-js', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true); wp_enqueue_script('navigation-js', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true); // Comments if (is_singular() && comments_open() && get_theme_mod('thread_comments')) { wp_enqueue_script('comment-reply'); } } add_action('wp_enqueue_scripts', 'atomy_scripts'); /* Require ========================================================================== */ // Custom template tags for this theme require get_template_directory() . '/inc/template-tags.php'; // Implement the Custom Header feature require get_template_directory() . '/inc/custom-header.php'; // Functions which enhance the theme by hooking into WordPress require get_template_directory() . '/inc/template-functions.php'; // Customizer additions require get_template_directory() . '/inc/customizer.php'; require get_template_directory() . '/inc/custom-controls.php'; /* Woocommerce ========================================================================== */ // Add thema Support function atomy_add_woocommerce_support() { add_theme_support('woocommerce'); } add_action('after_setup_theme', 'atomy_add_woocommerce_support'); // Ensure cart contents update when products are added to the cart via AJAX function atomy_header_add_to_cart_fragment($fragments) { ob_start(); $count = WC()->cart->cart_contents_count; ?> 0) { ?> term_id; $prod_term = get_term($cat_id, 'product_cat'); $description = $prod_term->description; echo '

' . $description . '

'; } // Change the breadcrumb separator add_filter('woocommerce_breadcrumb_defaults', 'atomy_change_breadcrumb_delimiter'); function atomy_change_breadcrumb_delimiter($defaults) { // Change the breadcrumb delimeter from '/' to '>' $defaults['delimiter'] = ' > '; return $defaults; } // Script custom select function atomy_select_dropdown() { wp_enqueue_script('select2js', get_template_directory_uri() . '/js/select2.min.js', array('jquery'), '4.0.6', true); wp_enqueue_style('atomy-select2css', get_template_directory_uri() . '/css/atomy-select2.css', array(), '4.0.6', 'all'); wp_enqueue_script('selectinit', get_template_directory_uri() . '/js/select2-init.js', array('select2js'), '1.0.0', true); } add_action('wp_enqueue_scripts', 'atomy_select_dropdown'); /* Class Navigation Menu ========================================================================== */ // Add Class -li- function atomy_add_classes_on_li($classes, $item, $args) { $classes[] = 'nav-item dropdown submenu'; return $classes; } add_filter('nav_menu_css_class', 'atomy_add_classes_on_li', 1, 3); // Add class -a- function atomy_add_menu_link_class($atts, $item, $args) { if (property_exists($args, 'link_class')) { $atts['class'] = $args->link_class; } return $atts; } add_filter('nav_menu_link_attributes', 'atomy_add_menu_link_class', 1, 3); // Add Class -Sub-menu- function atomy_some_function($classes, $args, $depth) { foreach ($classes as $key => $class) { if ($class == 'sub-menu') { $classes[$key] = 'dropdown-menu'; } } return $classes; } add_filter('nav_menu_submenu_css_class', 'atomy_some_function', 10, 3); // Add filter dropdown-toggle function atomy_add_class_to_items_link($atts, $item, $args) { // check if the item has children $hasChildren = (in_array('menu-item-has-children', $item->classes)); if ($hasChildren) { // add the desired attributes: $atts['class'] = 'dropdown-toggle'; $atts['data-toggle'] = 'dropdown'; $atts['data-target'] = '#'; } return $atts; } add_filter('nav_menu_link_attributes', 'atomy_add_class_to_items_link', 10, 3); /* Add Menu Fallback ========================================================================== */ function atomy_link_to_menu_editor($args) { if (!current_user_can('manage_options')) { return; } // see wp-includes/nav-menu-template.php for available arguments extract($args); $link = $link_before . '' . $before . __('Add a menu', 'atomy') . $after . '' . $link_after; // We have a list if ( FALSE !== stripos($items_wrap, 'register_panel_type('Atomy_WP_Customize_Panel'); $wp_customize->register_section_type('Atomy_WP_Customize_Section'); } add_action('customize_register', 'atomy_pe_customize_register'); /* Custom Navigation ========================================================================== */ function atomy_the_post_navigation($args = array()) { $args = wp_parse_args($args, array( 'prev_text' => '' . __('Previous Post:', 'atomy') . '
' . '%title' . '', 'next_text' => __('Next Post:', 'atomy') . '' . '
' . '%title' . '', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category', 'screen_reader_text' => __('Post navigation', 'atomy'), )); $navigation = ''; $previous = get_previous_post_link( '', $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] ); $next = get_next_post_link( '', $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] ); // Only add markup if there's somewhere to navigate to. if ($previous || $next) { $navigation = _navigation_markup($previous . $next, 'post-navigation', $args['screen_reader_text']); } return $navigation; } /* Google Font site ========================================================================== */ function atomy_custom_add_google_fonts() { wp_enqueue_style('atomy-custom-google-fonts', 'https://fonts.googleapis.com/css?family=Inconsolata:200,300,400,500,600,700,800,900|Indie+Flower:200,300,400,500,600,700,800,900|Lato:200,300,400,500,600,700,800,900|Montserrat:200,300,400,500,600,700,800,900|Roboto:200,300,400,500,600,700,800,900|Text+Me+One:200,300,400,500,600,700,800,900|Titillium+Web:200,300,400,500,600,700,800,900|Ubuntu:200,300,400,500,600,700,800,900', false); } add_action('wp_enqueue_scripts', 'atomy_custom_add_google_fonts'); /* Custom button Pause/Play ========================================================================== */ add_filter('header_video_settings', 'atomy_video_settings'); function atomy_video_settings($settings) { $settings['l10n'] = array( 'pause' => '', 'play' => '', ); return $settings; } /* Breadcrumbs ========================================================================== */ function atomy_custom_breadcrumbs() { $sep = ' > '; if (!is_front_page()) { // Start the breadcrumb with a link to your homepage echo ''; } } /* Magnific popup - https://dimsemenov.com/plugins/magnific-popup/ ========================================================================== */ add_action('wp_enqueue_scripts', 'atomy_enqueue_magnificpopup_styles'); function atomy_enqueue_magnificpopup_styles() { wp_enqueue_style('magnific_popup_style', get_template_directory_uri() . '/magnific-popup/magnific-popup.css', array()); } add_action('wp_enqueue_scripts', 'atomy_enqueue_magnificpopup_scripts'); function atomy_enqueue_magnificpopup_scripts() { wp_enqueue_script('magnific_popup_script', get_template_directory_uri() . '/magnific-popup/jquery.magnific-popup.min.js', array('jquery')); wp_enqueue_script('magnific_init_script', get_template_directory_uri() . '/magnific-popup/jquery.magnific-popup-init.js', array('jquery')); } /* Include Plugin ========================================================================== */ require_once get_template_directory() . '/atomy-functionality-plugin/class-tgm-plugin-activation.php'; add_action('tgmpa_register', 'atomy_register_required_plugins'); function atomy_register_required_plugins() { /* * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( // BubiBlock Slider array( 'name' => __('BubiBlock Slider', 'atomy'), 'slug' => 'bubiblock-slider', 'required' => false, ), // Contact Form 7 array( 'name' => __('Contact Form 7', 'atomy'), 'slug' => 'contact-form-7', 'required' => false, ), // WooCommerce array( 'name' => __('WooCommerce', 'atomy'), 'slug' => 'woocommerce', 'required' => false, ), // YITH WooCommerce Quick View array( 'name' => __('YITH WooCommerce Quick View', 'atomy'), 'slug' => 'yith-woocommerce-quick-view', 'required' => false, ), // I WooCommerce Wishlist array( 'name' => __('TI WooCommerce Wishlist', 'atomy'), 'slug' => 'ti-woocommerce-wishlist', 'required' => false, ), // YITH WooCommerce Zoom Magnifier array( 'name' => __('YITH WooCommerce Zoom Magnifier', 'atomy'), 'slug' => 'yith-woocommerce-zoom-magnifier', 'required' => false, ), ); $config = array( 'id' => 'atomy', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. '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' => '', // Message to output right before the plugins table. 'strings' => array( 'page_title' => __('Install Required Plugins', 'atomy'), 'menu_title' => __('Install Plugins', 'atomy'), /* translators: %s: search term */ 'installing' => __('Installing Plugin: %s', 'atomy'), /* translators: %s: search term */ 'updating' => __('Updating Plugin: %s', 'atomy'), 'oops' => __('Something went wrong with the plugin API.', 'atomy'), /* translators: %1: search term */ 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'atomy' ), /* translators: %1: search term */ 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'atomy' ), /* translators: %1: search term */ 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'atomy' ), /* translators: %1: search term */ 'notice_ask_to_update_maybe' => _n_noop( 'There is an update available for: %1$s.', 'There are updates available for the following plugins: %1$s.', 'atomy' ), /* translators: %1: search term */ 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'atomy' ), /* translators: %1: search term */ 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'atomy' ), 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'atomy' ), 'update_link' => _n_noop( 'Begin updating plugin', 'Begin updating plugins', 'atomy' ), 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'atomy' ), 'return' => __('Return to Required Plugins Installer', 'atomy'), 'plugin_activated' => __('Plugin activated successfully.', 'atomy'), 'activated_successfully' => __('The following plugin was activated successfully:', 'atomy'), /* translators: %1: search term */ 'plugin_already_active' => __('No action taken. Plugin %1$s was already active.', 'atomy'), /* translators: %s: search term */ 'plugin_needs_higher_version' => __('Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'atomy'), /* translators: %1: search term */ 'complete' => __('All plugins installed and activated successfully. %1$s', 'atomy'), 'dismiss' => __('Dismiss this notice', 'atomy'), 'notice_cannot_install_activate' => __('There are one or more required or recommended plugins to install, update or activate.', 'atomy'), 'contact_admin' => __('Please contact the administrator of this site for help.', 'atomy'), 'nag_type' => '', // Determines admin notice type - can only be one of the typical WP notice classes, such as 'updated', 'update-nag', 'notice-warning', 'notice-info' or 'error'. Some of which may not work as expected in older WP versions. ), ); tgmpa($plugins, $config); } /* Atomy Admin Page ========================================================================== */ function atomy_page_create() { add_theme_page('Atomy', 'ATOMY', 'edit_theme_options', 'atomy_page', 'atomy_page_display', 1); } add_action('admin_menu', 'atomy_page_create'); require get_template_directory() . '/atomy-admin/atomy-support.php'; //Include Admin Style function atomy_load_admin_style($hook) { if ($hook == 'appearance_page_atomy_page') { wp_enqueue_style('atomy-admin-css', get_template_directory_uri() . '/atomy-admin/css/atomy-admin-style.css', false, '1.0.0'); wp_enqueue_script('atomy-admin-script', get_template_directory_uri() . '/atomy-admin/js/atomy-admin-script.js', false, '1.0.0'); wp_enqueue_style('atomy-font-awesome-admin', get_template_directory_uri() . '/css/fontawesome-all.min.css'); } } add_action('admin_enqueue_scripts', 'atomy_load_admin_style'); /* Url Admin Support / Copyright ========================================================================== */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly. } define('atomy_url_promotion', 'https://franchiwebdesign.com/portfolio/atomy/'); // Go Pro define('franchi_design_url', 'https://franchiwebdesign.com/'); // Franchi Design define('atomy_url_documentation_theme', 'https://franchiwebdesign.com/category/documentazione-atomy/'); // Documentation Theme define('atomy_url_support_theme', 'https://franchiwebdesign.com/supporto/'); // Support Theme define('atomy_review_theme', 'https://wordpress.org/support/theme/atomy/reviews/'); // Review Theme define('atomy_forum_theme', 'https://franchiwebdesign.com/community/index.php'); // Forum Theme define('atomy_bubiblock_slider', 'https://wordpress.org/plugins/bubiblock-slider/'); // BubiBlock Slider