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' => 'fafafa',
) ) );
// Support for Video
add_theme_support( 'custom-header', array(
'video' => true,
));
// 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() {
$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__('Sidebar Blog','atomy'),
'id' => 'sidebar-1',
'description' => esc_html__('Add widgets here.','atomy'),
'before_widget' => '',
'before_title' => '
',
) );
// Widget Card With Sidebar Section
register_sidebar( array(
'name' => esc_html__('Card With Sidebar Section/Sidebar Store','atomy'),
'id' => 'sidebar-3',
'description' => esc_html__('Add widgets here.','atomy'),
'before_widget' => '',
'before_title' => '',
) );
// Widget Contact Header
register_sidebar( array(
'name' => esc_html__('Contact Header','atomy'),
'id' => 'sidebar-8',
'description' => esc_html__('Add widgets here.','atomy'),
'before_widget' => '',
'before_title' => '',
) );
// Widget Contact
register_sidebar( array(
'name' => esc_html__('Contact Body','atomy'),
'id' => 'sidebar-9',
'description' => esc_html__('Add widgets here.','atomy'),
'before_widget' => '',
'before_title' => '',
) );
// Widget Contact Sidebar
register_sidebar( array(
'name' => esc_html__('Contact Sidebar','atomy'),
'id' => 'sidebar-10',
'description' => esc_html__('Add widgets here.','atomy'),
'before_widget' => '',
'before_title' => '',
) );
// Widget Services One
register_sidebar( array(
'name' => esc_html__('Services One','atomy'),
'id' => 'sidebar-15',
'description' => esc_html__('Enter a Widget','atomy'),
'before_widget' => '',
'before_title' => '',
) );
// Widget Services Two
register_sidebar( array(
'name' => esc_html__('Services Two','atomy'),
'id' => 'sidebar-16',
'description' => esc_html__('Enter a Widget','atomy'),
'before_widget' => '',
'before_title' => '',
) );
// Widget Services Three
register_sidebar( array(
'name' => esc_html__('Services Three','atomy'),
'id' => 'sidebar-17',
'description' => esc_html__('Enter a Widget','atomy'),
'before_widget' => '',
'before_title' => '',
) );
}
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.0', 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 '';
}
// 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_stylesheet_directory_uri() . '/js/select2.min.js', array( 'jquery' ), '4.0.6', true );
wp_enqueue_style( 'atomy-select2css', get_stylesheet_directory_uri() . '/css/atomy-select2.css' , array(), '4.0.6', 'all' );
wp_enqueue_script( 'selectinit', get_stylesheet_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, '