__( 'Top Menu', 'astore' ), 'browse-categories' => __( 'Top Left Menu (Browse Categories)', 'astore' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'height' => 100, 'flex-width' => true, 'flex-height' => true, ) ); // Setup the WordPress core custom header feature. add_theme_support( 'custom-header', array( 'default-image' => '', 'random-default' => false, 'width' => '1920', 'height' => '70', 'flex-height' => true, 'flex-width' => true, 'default-text-color' => '#333333', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '' )); // Setup the WordPress core custom background feature. add_theme_support( 'custom-background', array( 'default-color' => 'ffffff', 'default-image' => '', ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Woocommerce Support add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); // Add Works Image size add_image_size( 'astore-works', 480, 360, true ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style( array( 'assets/css/editor-style.css' ) ); } add_action( 'after_setup_theme', 'astore_setup' ); /** * After switch theme */ function astore_after_switch_theme(){ delete_option('astore_welcome_notice'); } add_action('after_switch_theme', 'astore_after_switch_theme'); /** * Enqueue scripts and styles. */ function astore_scripts() { global $astore_options; $astore_options = get_option(ASTORE_TEXTDOMAIN); $headings_font_family = esc_attr(astore_option( 'headings_font_family')); $body_font_family = esc_attr(astore_option( 'body_font_family')); $page_preloader = absint(astore_option( 'page_preloader')); $fonts[] = $headings_font_family; $fonts[] = $body_font_family; $theme_info = wp_get_theme(); wp_enqueue_style( 'astore-google-fonts', customizer_library_get_google_font_uri($fonts), false, '', false ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() .'/assets/plugins/bootstrap/css/bootstrap.css', false, '', false ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() .'/assets/plugins/font-awesome/css/font-awesome.min.css', false, '', false ); wp_enqueue_style( 'owl-carousel', get_template_directory_uri() .'/assets/plugins/owl-carousel/css/owl.carousel.css', false, '', false ); wp_enqueue_style( 'animate', get_template_directory_uri() .'/assets/plugins/animate.css' ); // Theme stylesheet. wp_enqueue_style( 'astore-style', get_stylesheet_uri(), array(), $theme_info->get( 'Version' ) ); if ( is_rtl() ) wp_enqueue_style( 'astore-rtl', get_template_directory_uri() .'/rtl.css' ); wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/plugins/bootstrap/js/bootstrap.min.js' , array( 'jquery' ), null, true); wp_enqueue_script( 'respond', get_template_directory_uri() . '/assets/plugins/respond.min.js' , array( 'jquery' ), null, true); wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/assets/plugins/owl-carousel/js/owl.carousel.min.js' , array( 'jquery' ), null, true); wp_enqueue_script( 'jquery-cookie', get_template_directory_uri() . '/assets/plugins/jquery.cookie.min.js' , array( 'jquery' ), null, true); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } $preloader_background = esc_attr(astore_option('preloader_background')); $preloader_opacity = esc_attr(astore_option('preloader_opacity')); $preloader_image = esc_attr(astore_option('preloader_image')); if (is_numeric($preloader_image)) { $image_attributes = wp_get_attachment_image_src($preloader_image, 'full'); $preloader_image = $image_attributes[0]; } $preloader_bg = ''; if($preloader_background!=''){ $rgb = astore_hex2rgb( $preloader_background ); $preloader_bg = "rgba(".$rgb[0].",".$rgb[1].",".$rgb[2].",".$preloader_opacity.")"; } wp_enqueue_script( 'astore-main', get_template_directory_uri() . '/assets/js/astore.js' , array( 'jquery' ), null, true); wp_localize_script( 'astore-main', 'astore_params', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'themeurl' => get_template_directory_uri(), 'page_preloader' => $page_preloader, 'preloader_background' => $preloader_bg, 'preloader_image' => $preloader_image, ) ); $custom_css = ''; $header_text_color = get_header_textcolor(); if ( 'blank' != $header_text_color ) : $custom_css .= ".site-name, .site-tagline { color: ".esc_attr( $header_text_color )." !important; }.site-tagline { display: none; }\r\n"; else: $custom_css .= ".site-name, .site-tagline { display: none; }\r\n"; endif; // Font family $custom_css .= "h1,h2,h3,h4,h5,h6{font-family:".$headings_font_family.";}"; $custom_css .= "body,button,input,select,textarea{font-family:".$body_font_family.";}"; // Font size $body_font_size = absint(astore_option('body_font_size')); if($body_font_size>0) $custom_css .= "html, body, div{font-size:".$body_font_size."px;}"; for($i=1;$i<=6;$i++){ $heading_font_size = absint(astore_option('h'.$i.'_font_size')); $custom_css .= "h".$i."{font-size:".$heading_font_size."px;}"; } // Section Font size $section_title_font_size = absint(astore_option('section_title_font_size')); $custom_css .= ".astore-section .astore-section-title{font-size:".$section_title_font_size."px;}"; $section_subtitle_font_size = absint(astore_option('section_subtitle_font_size')); $custom_css .= ".astore-section .astore-section-desc{font-size:".$section_subtitle_font_size."px;}"; $section_item_title_font_size = absint(astore_option('section_item_title_font_size')); $custom_css .= ".astore-section h4{font-size:".$section_item_title_font_size."px;}"; $section_content_font_size = absint(astore_option('section_content_font_size')); $custom_css .= ".astore-section, .astore-section p, .astore-section div{font-size:".$section_content_font_size."px;}"; // Font color $section_title_color = esc_attr(astore_option( 'section_title_color')); $section_subtitle_color = esc_attr(astore_option( 'section_subtitle_color')); $section_item_title_color = esc_attr(astore_option( 'section_item_title_color')); $section_content_color = esc_attr(astore_option( 'section_content_color')); $section_link_color = esc_attr(astore_option( 'section_link_color')); $section_link_hover_color = esc_attr(astore_option( 'section_link_hover_color')); $section_icon_color = esc_attr(astore_option( 'section_icon_color')); $custom_css .= ".astore-section-title { color: ".$section_title_color."; }"; $custom_css .= ".astore-section-desc { color: ".$section_subtitle_color."; }"; $custom_css .= ".astore-feature-caption h4, .astore-team-vcard h4, .astore-counter-title, .astore-section .astore-testimonial-name, .astore-section .entry-title, .astore-section .woocommerce ul.products li.product h3 { color: ".$section_item_title_color."; }"; $custom_css .= ".astore-section-content { color: ".$section_content_color."; }"; $custom_css .= ".astore-section-content a { color: ".$section_link_color."; }"; $custom_css .= ".astore-section-content a:hover { color: ".$section_link_hover_color."; }"; $custom_css .= ".astore-feature-item i, .astore-counter-item i, .astore-feature-item i { color: ".$section_icon_color."; }"; $sticky_header_background_color = astore_option('sticky_header_background_color'); $sticky_header_background_opacity = astore_option('sticky_header_background_opacity'); if( $sticky_header_background_color!='' ){ $rgb = customizer_library_hex_to_rgb($sticky_header_background_color); $custom_css .= "header .astore-fixed-header-wrap,header .astore-fixed-header-wrap .astore-header{background-color:rgba(".$rgb['r'].",".$rgb['g'].",".$rgb['b'].",".$sticky_header_background_opacity.");}"; } $custom_css = apply_filters( 'astore_additional_css', $custom_css ); wp_add_inline_style( 'astore-style', wp_filter_nohtml_kses($custom_css) ); } add_action( 'wp_enqueue_scripts', 'astore_scripts' ); function astore_admin_scripts(){ global $pagenow; wp_enqueue_script( 'astore-admin', get_template_directory_uri().'/assets/js/admin.js', array( 'jquery' ), '', true ); if( $pagenow == "themes.php" && isset($_GET['page']) && $_GET['page'] == "astore-welcome" ): wp_enqueue_style( 'astore-admin', get_template_directory_uri() . '/assets/css/admin.css', '', '', false ); endif; wp_localize_script( 'astore-admin', 'astore_admin', array( 'ajaxurl' => admin_url('admin-ajax.php'), ) ); } add_action( 'admin_enqueue_scripts', 'astore_admin_scripts' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function astore_customize_controls_enqueue(){ wp_enqueue_style( 'astore_library_customizer', get_template_directory_uri() . '/assets/css/customizer.css', '', '1.0.0', false ); wp_enqueue_script( 'astore_library_customizer_controls', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview'), '1.0.0', true ); $loading = __('Updating','astore'); $complete = __('Complete','astore'); $error = __('Error','astore'); $confirm = esc_js( __( 'Click OK to reset. Any AStore options will be rastored!', 'astore' ) ); wp_localize_script( 'astore_library_customizer_controls', 'astore_customize_params', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'themeurl' => get_template_directory_uri(), 'loading' => $loading, 'complete' => $complete, 'error' => $error, 'confirm' =>$confirm, ) ); } add_action( 'customize_controls_init', 'astore_customize_controls_enqueue' ); function astore_customize_preview_enqueue(){ wp_enqueue_script( 'astore_library_customizer_preview', get_template_directory_uri() . '/assets/js/customizer-preview.js', array( 'jquery' ), '1.0.0', true ); } add_action( 'customize_preview_init', 'astore_customize_preview_enqueue' ); /** * Prints HTML with meta information for the current post-date/time and author. */ function astore_posted_on() { // Get the author name; wrap it in a link. $byline = sprintf( /* translators: %s: post author */ __( 'by %s', 'astore' ), ' ' . get_the_author() . '' ); // Finally, let's write all of this to the page. echo '' . astore_time_link() . ' | ' . $byline . ''; } /** * Gets a nicely formatted string for the published date. */ function astore_time_link() { $time_string = ''; $time_string = sprintf( $time_string, get_the_date( DATE_W3C ), get_the_date(), get_the_modified_date( DATE_W3C ), get_the_modified_date() ); // Wrap the time string in a link, and preface it with 'Posted on'. return sprintf( /* translators: %s: post date */ __( 'Posted on %s ', 'astore' ), '' . $time_string . '' ); } /** * Returns an accessibility-friendly link to edit a post or page. */ function astore_edit_link() { $link = edit_post_link( sprintf( /* translators: %s: Name of current post */ __( 'Edit "%s"', 'astore' ), get_the_title() ), '', '' ); return $link; } /** * Register widget area. * */ function astore_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'astore' ), 'id' => 'sidebar-1', 'description' => __( 'Add widgets here to appear in your sidebar.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Page Sidebar', 'astore' ), 'id' => 'sidebar-page', 'description' => __( 'Add widgets here to appear in your pages sidebar.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Blog Sidebar', 'astore' ), 'id' => 'sidebar-blog', 'description' => __( 'Add widgets here to appear in your posts sidebar.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Archives', 'astore' ), 'id' => 'sidebar-archives', 'description' => __( 'Add widgets here to appear in your posts list sidebar.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'WooCommerce Single Product', 'astore' ), 'id' => 'sidebar-woo-single', 'description' => __( 'Add widgets here to appear in your products sidebar.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'WooCommerce Archives', 'astore' ), 'id' => 'sidebar-woo-archives', 'description' => __( 'Add widgets here to appear in your products list sidebar.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 1', 'astore' ), 'id' => 'footer-1', 'description' => __( 'Add widgets here to appear in your footer.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 2', 'astore' ), 'id' => 'footer-2', 'description' => __( 'Add widgets here to appear in your footer.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 3', 'astore' ), 'id' => 'footer-3', 'description' => __( 'Add widgets here to appear in your footer.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 4', 'astore' ), 'id' => 'footer-4', 'description' => __( 'Add widgets here to appear in your footer.', 'astore' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'astore_widgets_init' ); /** * Custom comments list */ function astore_comment($comment, $args, $depth) { ?>
  • id="comment-">

    - $depth, 'max_depth' => $args['max_depth']))) ;?>

    comment_approved == '0') : ?>
  • '; $after = ''; if ( !is_home() && !is_front_page() || is_paged() ) { echo '
    '; global $post; $homeLink = esc_url(home_url()); echo ' ' . __( 'Home' , 'astore' ) . ' ' . $delimiter . ' '; if ( is_category() ) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $thisCat = $cat_obj->term_id; $thisCat = get_category($thisCat); $parentCat = get_category($thisCat->parent); if ($thisCat->parent != 0){ $cat_code = get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '); echo $cat_code = str_replace ('' . get_the_time('Y') . ' ' . $delimiter . ' '; echo '' . get_the_time('F') . ' ' . $delimiter . ' '; echo $before . get_the_time('d') . $after; } elseif ( is_month() ) { echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; echo $before . get_the_time('F') . $after; } elseif ( is_year() ) { echo $before . get_the_time('Y') . $after; } elseif ( is_single() && !is_attachment() ) { if ( get_post_type() != 'post' ) { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '' . $post_type->labels->singular_name . ' ' . $delimiter . ' '; echo $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; $cat_code = get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); echo $cat_code = str_replace ('labels->singular_name . $after; } elseif ( is_attachment() ) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = isset($cat[0])?$cat[0]:''; echo '' . $parent->post_title . ' ' . $delimiter . ' '; echo $before . get_the_title() . $after; } elseif ( is_page() && !$post->post_parent ) { echo $before . get_the_title() . $after; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . get_the_title($page->ID) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' '; echo $before . get_the_title() . $after; } elseif ( is_search() ) { echo $before ; printf( __( 'Search Results for: %s', 'astore' ), get_search_query() ); echo $after; } elseif ( is_tag() ) { echo $before ; printf( __( 'Tag Archives: %s', 'astore' ), single_tag_title( '', false ) ); echo $after; } elseif ( is_author() ) { global $author; $userdata = get_userdata($author); echo $before ; printf( __( 'Author Archives: %s', 'astore' ), $userdata->display_name ); echo $after; } elseif ( is_404() ) { echo $before; _e( 'Not Found', 'astore' ); echo $after; } if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo sprintf( __( '( Page %s )', 'astore' ), get_query_var('paged') ); } echo '
    '; } } /** * Get option */ function astore_option($name){ global $astore_options,$astore_customizer_options; if(!$astore_customizer_options){ $astore_customizer_options = astore_customizer_library_options(); } if( isset($astore_options[$name]) ) return $astore_options[$name]; elseif(isset($astore_customizer_options[$name]['default'])){ return $astore_customizer_options[$name]['default']; } else return ''; } function astore_option_saved($name){ $astore_options = get_option(ASTORE_TEXTDOMAIN); if( isset($astore_options[$name]) ) return $astore_options[$name]; else return ''; } /** * Get sidebar */ function astore_get_sidebar($layout,$type){ if($layout=='' || $layout == 'none' || $layout == 'no' ) return ''; ?>
    selective_refresh ) ) { return; } // Bail early if we don't have any options. if ( empty( $astore_customizer_options ) ) { return; } $wp_customize->selective_refresh->add_partial( 'copyright_selective', array( 'selector' => '.copyright_selective', 'settings' => array( 'astore[copyright]' ), 'render_callback' => 'astore_copyright', ) ); $wp_customize->selective_refresh->add_partial( 'header_site_title', array( 'selector' => '.site-name', 'settings' => array( 'blogname' ), 'render_callback' => 'astore_header_site_title', ) ); $wp_customize->selective_refresh->add_partial( 'header_site_description', array( 'selector' => '.site-tagline', 'settings' => array( 'blogdescription' ), 'render_callback' => 'astore_header_site_descriptione', ) ); $wp_customize->get_section ('title_tagline')->panel = 'panel-header'; //$wp_customize->get_section ('colors')->panel = 'panel-header'; $wp_customize->get_section ('header_image')->panel = 'panel-header'; } add_action( 'customize_register', 'astore_register_partials' ); /* footer */ function astore_copyright(){ $astore_options = get_option(ASTORE_TEXTDOMAIN); if( isset($astore_options['copyright']) ) return $astore_options['copyright']; } //button_text_call_to_action function astore_header_site_title(){ return get_bloginfo( 'name' ); } function astore_header_site_descriptione(){ return get_bloginfo( 'description' ); } /** * Get WooCommerce products categories. * */ function astore_get_woo_categories() { if ( ! class_exists( 'WooCommerce' ) ) { return array(); } $astore_categories_array = array(); $astore_prod_categories = get_categories( array( 'taxonomy' => 'product_cat', 'hide_empty' => 1, 'title_li' => '', ) ); if ( ! empty( $astore_prod_categories ) ) { foreach ( $astore_prod_categories as $astore_prod_cat ) { if ( ! empty( $astore_prod_cat->term_id ) && ! empty( $astore_prod_cat->name ) ) { $astore_categories_array[ $astore_prod_cat->term_id ] = $astore_prod_cat->name; } } } return $astore_categories_array; } /* * Notifications in customize */ require get_template_directory() . '/inc/customizer-notify/class-astore-customizer-notify.php'; $config_customizer = array( 'recommended_plugins' => array( 'elementor' => array( 'recommended' => true, 'description' => sprintf( esc_html__( 'Install and activate %s plugin to build your front page.', 'astore' ), 'Elementor Page Builder' ), ), 'astore-companion' => array( 'recommended' => true, 'description' => sprintf( esc_html__( 'Install and activate %s plugin to take full advantage of AStore theme. More options could be found at Customize and page meta options.', 'astore' ), sprintf( '%s', 'AStore Companion' ) ), ), ), 'recommended_actions' => array(), 'recommended_actions_title' => esc_html__( 'Recommended Actions', 'astore' ), 'recommended_plugins_title' => esc_html__( 'Recommended Plugins', 'astore' ), 'install_button_label' => esc_html__( 'Install and Activate', 'astore' ), 'activate_button_label' => esc_html__( 'Activate', 'astore' ), 'deactivate_button_label' => esc_html__( 'Deactivate', 'astore' ), ); AStore_Customizer_Notify::init( apply_filters( 'astore_customizer_notify_array', $config_customizer ) ); /** * Welcome notice. * */ function astore_welcome_notice() { global $pagenow; if(function_exists('is_plugin_active') && is_plugin_active('astore-companion/astore-companion.php')){ return ''; } $theme = wp_get_theme(); if ( is_child_theme() ) { $theme_name = $theme->parent()->get( 'Name' ); } else { $theme_name = $theme->get( 'Name' ); } $theme_version = $theme->get( 'Version' ); $theme_slug = $theme->get_template(); $astore_welcome_notice = get_option('astore_welcome_notice'); if($astore_welcome_notice == '1') return ''; if( $pagenow == "themes.php" && isset($_GET['page']) && $_GET['page'] == "astore-welcome" ): return ''; endif; ?>

    AStore Companion plugin.', esc_url('https://wordpress.org/plugins/astore-companion/') ); ?>

    ' . __('Go to Customize', 'astore') . ' '; ?>

    '; echo '

    '.esc_attr__('About AStore', 'astore' ).'

    '; echo '

    '.sprintf(esc_attr__('Welcome to %s Version %s', 'astore'),$theme_info->get( 'Name' ), $theme_info->get( 'Version' ) ).'

    '.sprintf(esc_attr__('%s is the best choice for building online store since it\'s fully compatible with WooCommerce, the most popular ecommerce plugin. Using Elementor page builder plugin, you could simply edit your site using just drag & drop.', 'astore'),$theme_info->get( 'Name' ) ).'

    '.esc_attr__('Documentation', 'astore' ).': https://velathemes.com/astore-documentation/

    '; echo ''; } /** * Add script to the footer * */ function astore_footer_script(){ $display_scroll_to_top = astore_option('display_scroll_to_top'); if($display_scroll_to_top=='1' || is_customize_preview() ){ $css_class = 'back-to-top'; if( $display_scroll_to_top !=1 && is_customize_preview() ) $css_class .= ' hide'; echo '
    '; } } add_action('wp_footer','astore_footer_script'); /** * Convert Hex Code to RGB * @param string $hex Color Hex Code * @return array RGB values */ function astore_hex2rgb( $hex ) { if ( strpos( $hex,'rgb' ) !== FALSE ) { $rgb_part = strstr( $hex, '(' ); $rgb_part = trim($rgb_part, '(' ); $rgb_part = rtrim($rgb_part, ')' ); $rgb_part = explode( ',', $rgb_part ); $rgb = array($rgb_part[0], $rgb_part[1], $rgb_part[2], $rgb_part[3]); } elseif( $hex == 'transparent' ) { $rgb = array( '255', '255', '255', '0' ); } else { $hex = str_replace( '#', '', $hex ); if( strlen( $hex ) == 3 ) { $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); } else { $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); } $rgb = array( $r, $g, $b ); } return $rgb; } /** * Mini cart */ add_filter('astore_shopping_cart','astore_add_cart_single_ajax', 10, 2); function astore_add_cart_single_ajax() { $html = ''; if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) { ob_start(); the_widget( 'WC_Widget_Cart' ); $html = ob_get_clean(); } return $html; } /** * Hide header & footer */ function astore_hide_header(){ if(isset($_GET['hide-header'])){ return 1; } } function astore_hide_footer(){ if(isset($_GET['hide-footer'])){ return 1; } } add_filter('astore_hide_header','astore_hide_header'); add_filter('astore_hide_footer','astore_hide_header'); /** * Filter woocommerce_subcategory_count_html */ function astore_subcategory_count_html( $string ){ $num = str_replace('(','',$string); $num = str_replace(')','',$num); if($num == 1){ $string = ''.$num.' '.__( 'Product', 'astore' ).''; }else{ $string = ''.$num.' '.__( 'Products', 'astore' ).''; } return $string; } add_filter('woocommerce_subcategory_count_html','astore_subcategory_count_html'); /** * Redirect to edit frontpage */ function astore_redirect_edit_frontpage(){ $frontpage_id = get_option( 'page_on_front' ); $redirect_url = add_query_arg( array( 'post' => $frontpage_id, 'action' => 'elementor', ), admin_url( 'post.php' ) ); echo @json_encode( array('redirect_url'=>$redirect_url) ); exit(0); } add_action('wp_ajax_astore_redirect_e_frontpage', 'astore_redirect_edit_frontpage'); add_action('wp_ajax_nopriv_astore_redirect_e_frontpage', 'astore_redirect_edit_frontpage');