is theme uses wp_nav_menu() in two locations.*/
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'techone'),
'vertical_menu' => esc_html__('Vertical Menu', 'techone'),
'vertical_menu_2' => esc_html__('Vertical Menu 2', 'techone'),
'top-left-menu' => esc_html__('Top bar left menu', 'techone'),
'top-right-menu' => esc_html__('Top bar right menu', 'techone'),
)
);
/*
* 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 support for Block Styles.*/
add_theme_support('wp-block-styles');
/* Add support for full and wide align images.*/
add_theme_support('align-wide');
/* Add support for editor styles.*/
add_theme_support('editor-styles');
/* Add support for responsive embedded content.*/
add_theme_support('responsive-embeds');
/*Support woocommerce*/
add_theme_support('woocommerce');
add_theme_support('wc-product-gallery-lightbox');
add_theme_support('wc-product-gallery-slider');
add_theme_support('wc-product-gallery-zoom');
}
/**
* Register widget area.
*
* @since TechOne 1.0
*
* @link https://codex.wordpress.org/Function_Reference/register_sidebar
*/
function widgets_init()
{
register_sidebar(array(
'name' => esc_html__('Widget Area', 'techone'),
'id' => 'widget-area',
'description' => esc_html__('Add widgets here to appear in your sidebar.', 'techone'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
)
);
register_sidebar(array(
'name' => esc_html__('Shop Widget Area', 'techone'),
'id' => 'shop-widget-area',
'description' => esc_html__('Add widgets here to appear in your sidebar.', 'techone'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
register_sidebar(array(
'name' => esc_html__('Shop Single Widget Area', 'techone'),
'id' => 'shop-single-widget-area',
'description' => esc_html__('Add widgets here to appear in your sidebar.', 'techone'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
}
function add_muti_widgets()
{
$opt_multi_slidebars = techone_option('opt_multi_slidebars', '');
if (is_array($opt_multi_slidebars) && count($opt_multi_slidebars) > 0) {
foreach ($opt_multi_slidebars as $value) {
if ($value && $value != '') {
register_sidebar(array(
'name' => $value,
'id' => 'kt-custom-sidebar-'.sanitize_key($value),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
)
);
}
}
}
}
/*Load Google fonts*/
function google_fonts_url()
{
$font_families = apply_filters('techone_fonts_online', array(
'Open Sans:300,300i,400,400i,600,600i,700,700i,800,800i',
'Roboto:400,500',
'Lato:400,400i,700,700i,900,900i',
'Rubik&display=swap'
));
$query_args = array(
'family' => urlencode(implode('|', $font_families)),
'subset' => urlencode('latin,latin-ext'),
);
$fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css');
return esc_url_raw($fonts_url);
}
/**
* Enqueue scripts and styles.
*
* @since techone 1.0
*/
function scripts()
{
/* Load fonts*/
wp_register_style('techone-googlefonts', $this->google_fonts_url(), array(), null, 'all');
/* Load our main stylesheet.*/
$theme_uri = get_template_directory_uri();
wp_register_style('slick', "{$theme_uri}/css/slick.min.css", array(), '1.0.1', 'all');
wp_register_style('techone-lib', "{$theme_uri}/css/lib.min.css", array(), '1.0.1', 'all');
wp_register_style('techone-icon', "{$theme_uri}/css/icons.min.css", array(), '1.0.1', 'all');
if (is_rtl()) {
wp_register_style('techone-style', "{$theme_uri}/css/style-rtl.min.css", array(
'slick',
'techone-lib',
'techone-icon',
'techone-googlefonts',
), '1.5.7', 'all');
} else {
wp_register_style('techone-style', "{$theme_uri}/css/style.min.css", array(
'slick',
'techone-lib',
'techone-icon',
'techone-googlefonts',
), '1.5.7', 'all');
}
wp_enqueue_style('techone-style');
wp_enqueue_style('techone-main-style', get_stylesheet_uri(), array(), '1.5.7', 'all');
/* Load lib js*/
wp_register_script('slick', "{$theme_uri}/js/slick.min.js", array('jquery'), '1.0.0', true);
wp_register_script('techone-lib', "{$theme_uri}/js/lib.min.js", array('jquery'), '1.2.0', true);
wp_register_script('lazyload', "{$theme_uri}/js/lazyload.min.js", array('jquery'), '1.7.10', true);
wp_register_script('techone-script', "{$theme_uri}/js/functions.min.js", array(
'lazyload',
'techone-lib',
'slick'
), '1.2.0', true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('techone-script');
wp_localize_script('techone-script', 'techone_ajax_fontend', array(
'ajaxurl' => admin_url('admin-ajax.php'),
'security' => wp_create_nonce('techone_ajax_fontend')
));
wp_localize_script('techone-script', 'techone_fontend_global_script', array(
'techone_enable_sticky_menu' => techone_option('techone_enable_sticky_menu', '0'),
'techone_enable_popup_mobile' => techone_option('techone_enable_popup_mobile', '0'),
'techone_popup_delay_time' => techone_option('techone_popup_delay_time', '0'),
'techone_enable_popup' => techone_option('techone_enable_popup', '0'),
'techone_enable_lazy' => techone_option('techone_enable_lazy', '1'),
'remove_cart_notification_text' => apply_filters('techone_remove_cart_notification_text', esc_html__('Removed', 'techone')),
'added_to_cart_notification_text' => apply_filters('techone_added_to_cart_notification_text', esc_html__('has been added to cart!', 'techone')),
'view_cart_notification_text' => apply_filters('techone_view_cart_notification_text', esc_html__('View Cart', 'techone')),
'added_to_cart_text' => apply_filters('techone_adding_to_cart_text', esc_html__('Product has been added to cart!', 'techone')),
'wc_cart_url' => (function_exists('wc_get_cart_url') ? esc_url(wc_get_cart_url()) : ''),
'added_to_wishlist_text' => get_option('yith_wcwl_product_added_text', esc_html__('Product has been added to wishlist!', 'techone')),
'wishlist_url' => (function_exists('YITH_WCWL') ? esc_url(YITH_WCWL()->get_wishlist_url()) : ''),
'browse_wishlist_text' => get_option('yith_wcwl_browse_wishlist_text', esc_html__('Browse Wishlist', 'techone')),
'growl_notice_text' => esc_html__('Notice!', 'techone'),
'removed_cart_text' => esc_html__('Product Removed', 'techone'),
'txt_years' => esc_html__('Years', 'techone'),
'txt_months' => esc_html__('Months', 'techone'),
'txt_weeks' => esc_html__('Weeks', 'techone'),
'txt_days' => esc_html__('Days', 'techone'),
'txt_hrs' => esc_html__('Hrs', 'techone'),
'txt_mins' => esc_html__('Mins', 'techone'),
'txt_secs' => esc_html__('Secs', 'techone'),
'mobile_menu_title' => esc_html__('Main Menu', 'techone')
));
/*remove style of chosen jquery plugin at woocommerce-products-filter plugin */
wp_dequeue_style('chosen-drop-down');
/*remove script of chosen jquery plugin at woocommerce-products-filter plugin */
wp_dequeue_script('chosen-drop-down');
}
/**
* Filter whether comments are open for a given post type.
*
* @param string $status Default status for the given post type,
* either 'open' or 'closed'.
* @param string $post_type Post type. Default is `post`.
* @param string $comment_type Type of comment. Default is `comment`.
*
* @return string (Maybe) filtered default status for the given post type.
*/
function open_default_comments_for_page($status, $post_type, $comment_type)
{
if ('page' == $post_type) {
return 'open';
}
return $status;
/*You could be more specific here for different comment types if desired*/
}
public function includes()
{
include_once(get_template_directory().'/framework/framework.php');
}
/* TABS AJAX */
public function techone_tab_product_via_ajax()
{
$response = array(
'html' => '',
'message' => '',
'success' => 'no',
);
$decode = isset($_POST['decode']) ? $_POST['decode'] : '';
$the_content = str_replace('\"', '"', $decode);
ob_start();
echo do_shortcode($the_content);
$response['html'] = ob_get_clean();
$response['success'] = 'ok';
wp_send_json($response);
die();
}
}
new TechOne_Functions();
}