Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once __DIR__ .'/vendor/autoload.php';
- add_action('wp_ajax_nopriv_logout-link', 'logoutLink');
- add_action('wp_ajax_logout-link', 'logoutLink');
- function logoutLink()
- {
- echo wp_logout_url(get_bloginfo('url'));
- die(1);
- }
- //wp_all_import Disable checking for duplicates
- //add_filter('wp_all_import_is_check_duplicates', 'disable_check_dupe_func', 10, 2);
- //Disable checking for duplicates
- function disable_check_dupe_func($truefalse, $thisid){
- return false;
- }
- function domain_title()
- {
- return DOMAIN_TITLE;
- }
- add_shortcode('domain_title', 'domain_title');
- function shortcode_handler()
- {
- return TELEPHONE;
- }
- add_shortcode('telephone_short', 'shortcode_handler');
- function addres_handler()
- {
- return ADDRESS;
- }
- add_shortcode('addres_handler', 'addres_handler');
- add_shortcode('wishlist_custom', 'wish_show');
- function wish_show()
- {
- $query_args = [];
- if (empty($wishlist_id)) {
- if (!empty($action) && $action == 'user') {
- $user_id = isset($action_params[ 1 ]) ? $action_params[ 1 ] : false;
- $user_id = (!$user_id) ? get_query_var($user_id, false) : $user_id;
- $user_id = (!$user_id) ? get_current_user_id() : $user_id;
- $wishlists = YITH_WCWL()->get_wishlists(['user_id' => $user_id, 'is_default' => 1]);
- if (!empty($wishlists) && isset($wishlists[ 0 ])) {
- $wishlist_id = $wishlists[ 0 ][ 'wishlist_token' ];
- } else {
- $wishlist_id = false;
- }
- } else {
- $wishlist_id = isset($action_params[ 1 ]) ? $action_params[ 1 ] : false;
- $wishlist_id = (!$wishlist_id) ? get_query_var('wishlist_id', false) : $wishlist_id;
- }
- }
- $is_user_owner = false;
- $query_args = [];
- if (!empty($user_id)) {
- $query_args[ 'user_id' ] = $user_id;
- $query_args[ 'is_default' ] = 1;
- if (get_current_user_id() == $user_id) {
- $is_user_owner = true;
- }
- } elseif (!is_user_logged_in()) {
- if (empty($wishlist_id)) {
- $query_args[ 'wishlist_id' ] = false;
- $is_user_owner = true;
- } else {
- $is_user_owner = false;
- $query_args[ 'wishlist_token' ] = $wishlist_id;
- $query_args[ 'wishlist_visibility' ] = 'visible';
- }
- } else {
- if (empty($wishlist_id)) {
- $query_args[ 'user_id' ] = get_current_user_id();
- $query_args[ 'is_default' ] = 1;
- $is_user_owner = true;
- } else {
- $wishlist = YITH_WCWL()->get_wishlist_detail_by_token($wishlist_id);
- $is_user_owner = $wishlist[ 'user_id' ] == get_current_user_id();
- $query_args[ 'wishlist_token' ] = $wishlist_id;
- if (!empty($wishlist) && $wishlist[ 'user_id' ] != get_current_user_id()) {
- $query_args[ 'user_id' ] = false;
- if (!current_user_can('manage_options')) {
- $query_args[ 'wishlist_visibility' ] = 'visible';
- }
- }
- }
- }
- $whishlis_items = YITH_WCWL()->get_products($query_args);
- ob_start();
- ?>
- <ul style="width: 302px;">
- <?php foreach ($whishlis_items as $item):
- $_product = wc_get_product($item[ 'prod_id' ]);
- $link = get_permalink($item[ 'prod_id' ]);
- ?>
- <li>
- <div style="clear:both;"></div>
- <a class="product" href="<?php echo $link; ?>">
- <img width="90"
- src="<?php echo get_the_post_thumbnail_url($item[ 'prod_id' ], [80, 80]); ?>">
- <?php echo $_product->get_title(); ?>
- </a>
- </li>
- <?php endforeach; ?>
- </ul>
- <?php
- $response = ob_get_contents();
- ob_end_clean();
- return $response;
- }
- include_once 'functions/CBC.php';
- include_once 'widgets/filters.php';
- include_once 'functions/ThanksPage.php';
- require_once(ABSPATH . 'wp-admin/includes/image.php');
- add_action('wp_enqueue_scripts', 'theme_name_scripts');
- add_action('rest_api_init', function ($server) {
- $server->register_route('login', '/login321', [
- 'methods' => 'POST',
- 'callback' => 'login_modal',
- ]);
- });
- add_action('rest_api_init', function ($server) {
- $server->register_route('register', '/register', [
- 'methods' => 'POST',
- 'callback' => 'Register_modal',
- ]);
- });
- add_action('rest_api_init', function ($server) {
- $server->register_route('sendPass', '/sendPass', [
- 'methods' => 'POST',
- 'callback' => 'SendPassModal',
- ]);
- });
- /**
- * @return string
- */
- function login_modal()
- {
- $creds = [
- 'user_login' => $_POST('username'),
- 'user_password' => $_POST('password'),
- 'remember' => true,
- ];
- $user = wp_signon($creds, false);
- if (is_wp_error($user)) {
- return json_encode(['success' => true]);
- } else {
- return json_encode(['success' => false, 'message' => $user->get_error_message(), 'error' => $user->get_error_code()]);
- }
- }
- function SendPassModal()
- {
- if (email_exists($_POST[ 'socialogin_email_forgot' ]) && ($_POST[ 'socialogin_email_forgot' ] != '')) {
- $password = wp_generate_password();
- $user = get_user_by('email', sanitize_text_field($_POST[ 'socialogin_email_forgot' ]));
- wp_set_password($password, $user->id);
- wpse_user_password_notification($user->id, $password);
- return json_encode(['success' => true, 'message' => 'A new password has been sent to your e-mail']);
- }
- return json_encode(['success' => false, 'message' => 'Can\'t find user with this email', 'error' => 'no user with this email']);
- }
- function Register_modal()
- {
- if (($_POST[ 'email' ] != '') && ($_POST[ 'pass' ] == $_POST[ 'passConfirm' ])) {
- //$user = wp_create_user(sanitize_text_field($_POST[ 'username' ]), sanitize_text_field($_POST[ 'pass' ]), sanitize_text_field($_POST[ 'email' ]));
- $default_newuser = [
- 'user_pass' => sanitize_text_field($_POST[ 'pass' ]),
- 'user_login' => sanitize_text_field($_POST[ 'username' ]),
- 'user_email' => sanitize_text_field($_POST[ 'email' ]),
- 'role' => 'subscriber',
- ];
- $user_id = wp_insert_user($default_newuser);
- if ($user_id && !is_wp_error($user_id)) {
- $code = sha1($user_id . time());
- $activation_link = add_query_arg(['key' => $code, 'user' => $user_id], get_permalink(266319));
- //add_user_meta($user_id, 'has_to_be_activated', $code, true);
- //$headers[] = 'From: ICONIC '.HOME_TITLE;
- $headers = ['Content-Type: text/html; charset=UTF-8', 'From: ICONIC ' . HOME_TITLE . ' <info@iconicjewelry.com>'];
- ob_start();
- include(locate_template('mail-register.php'));
- $response = ob_get_contents();
- ob_end_clean();
- if (!wp_mail(sanitize_text_field($_POST[ 'email' ]), 'ACTIVATION LINK', $response, $headers)) {
- return json_encode(['success' => false, 'message' => 'Error', 'error' => '123']);
- }
- return json_encode(['success' => true, 'message' => 'Activation link has been sent to your e-mail']);
- } else {
- return json_encode(['success' => false, 'message' => $user_id->get_error_message(), 'error' => $user_id->get_error_code()]);
- }
- }
- return json_encode(['success' => false]);
- }
- function wpml_custom_flags()
- {
- $languages = icl_get_languages('skip_missing=1');
- $curr_lang = [];
- if (!empty($languages)) {
- foreach ($languages as $language) {
- if (!empty($language[ 'active' ])) {
- $curr_lang = $language; // This will contain current language info.
- break;
- }
- }
- }
- return $curr_lang;
- }
- function wpse_user_password_notification($user_id, $plaintext_pass = '')
- {
- if (empty($plaintext_pass))
- return false;
- $user = get_userdata($user_id);
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
- $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
- $message .= sprintf(__('New Password: %s'), $plaintext_pass) . "\r\n";
- $message .= get_bloginfo('url') . "\r\n";
- return wp_mail($user->user_email, sprintf(__('[%s] Your username and new password'), $blogname), $message);
- }
- add_action('template_redirect', 'wpse8170_activate_user');
- function wpse8170_activate_user()
- {
- if (is_page() && get_the_ID() == 266319) {
- $user_id = filter_input(INPUT_GET, 'user', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
- if ($user_id) {
- // get user meta activation hash field
- //$code = get_user_meta($user_id, 'has_to_be_activated', true);
- //if ($code == filter_input(INPUT_GET, 'key')) {
- // delete_user_meta($user_id, 'has_to_be_activated');
- //}
- }
- }
- }
- add_filter('authenticate', 'my_custom_authenticate', 10, 3);
- function my_custom_authenticate($user, $username, $password)
- {
- $user = get_user_by('login', $username);
- if ($user == null) {
- $user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username or incorrect password.'));
- } elseif (0) { //get_user_meta($user->ID, 'has_to_be_activated', true)) {
- remove_action('authenticate', 'wp_authenticate_username_password', 20);
- remove_action('authenticate', 'wp_authenticate_email_password', 20);
- $user = new WP_Error('denied', __('<strong>ERROR</strong>: User is not activated.'));
- }
- return null;
- }
- add_filter('body_class', 'custom_class');
- function custom_class($classes)
- {
- if (is_front_page()):
- $classes[] = "cms-home";
- $classes[] = "cms-index-index ";
- endif;
- if (is_product()):
- $classes[] = "catalog-product-view";
- endif;
- if (is_product_category()):
- $classes[] = "catalog-category-view";
- endif;
- if (is_product_category()) {
- unset($classes[ array_search('woocommerce', $classes) ]);
- unset($classes[ array_search('woocommerce-page', $classes) ]);
- }
- return $classes;
- }
- // add_action('wp_print_styles', 'theme_name_scripts'); // можно использовать этот хук он более поздний
- function theme_name_scripts()
- {
- global $WOOCS;
- wp_enqueue_style('iconic-script', get_template_directory_uri() . '/assets/css/main-2.css');
- wp_enqueue_style('iconic-script-media', get_template_directory_uri() . '/assets/css/media.css');
- wp_enqueue_style('grid', get_template_directory_uri() . '/assets/css/grid.css');
- wp_enqueue_style('MyFontsWebfontsKit', get_template_directory_uri() . '/assets/css/main.css');
- wp_enqueue_style('FA-fonts', get_template_directory_uri() . '/assets/css/font-awesome.min.css');
- wp_enqueue_script('noconflict-js', get_template_directory_uri() . '/assets/js/noConflict.js', ['jquery'], '', false);
- wp_enqueue_script('selectbox-js', get_template_directory_uri() . '/assets/js/jquery.selectbox-0.2.min.js', [], '', false);
- wp_enqueue_script('fancybox-js', get_template_directory_uri() . '/assets/js/jquery.fancybox-1.3.4.pack.js', [], '', false);
- wp_enqueue_script('main-js', get_template_directory_uri() . '/assets/js/main-app.js', [], '1.15', false);
- wp_localize_script('main-js', 'price_f',
- [
- 'currency__symbol' => get_woocommerce_currency_symbol(),
- 'cur_curr' => $WOOCS->current_currency,
- ]
- );
- wp_enqueue_script('slick-js', get_template_directory_uri() . '/assets/js/slick.js', ['jquery'], '1.20', true);
- wp_enqueue_script('popup', get_template_directory_uri() . '/assets/js/mb_popup.js', [], '1.20', true);
- wp_enqueue_script('product-js', get_template_directory_uri() . '/assets/js/product.js', [], '1.20', true);
- wp_localize_script('product-js', 'myajax',
- [
- 'url' => admin_url('admin-ajax.php'),
- 'nonce' => wp_create_nonce('myajax-nonce'),
- ]
- );
- wp_enqueue_script('lazy-js', get_template_directory_uri() . '/assets/js/jquery.lazyload.min.js', ['jquery'], '1.20', true);
- if (is_page('faq')) {
- wp_enqueue_script('faq-js', get_template_directory_uri() . '/assets/js/faq.js', [], '1.20', true);
- }
- if (is_page('press')) {
- wp_enqueue_script('press-js', get_template_directory_uri() . '/assets/js/press.js', [], '1.20', true);
- }
- if (is_product_category()):
- wp_enqueue_script('jquery.endless-scroll', get_template_directory_uri() . '/assets/js/jquery.endless-scroll.js', ['jquery'], '1.20', true);
- wp_enqueue_script('category-js', get_template_directory_uri() . '/assets/js/category.js', [], '1.20', true);
- wp_localize_script('category-js', 'myajax',
- [
- 'url' => admin_url('admin-ajax.php'),
- 'nonce' => wp_create_nonce('myajax-nonce'),
- ]
- );
- endif;
- if (is_page('checkout')) {
- wp_enqueue_style('checkout', get_template_directory_uri() . '/assets/css/checkout.css');
- }
- }
- //
- // add_filter('request', function( $vars ) {
- // global $wpdb;
- // if( ! empty( $vars['pagename'] ) || ! empty( $vars['category_name'] ) || ! empty( $vars['name'] ) || ! empty( $vars['attachment'] ) ) {
- // $slug = ! empty( $vars['pagename'] ) ? $vars['pagename'] : ( ! empty( $vars['name'] ) ? $vars['name'] : ( !empty( $vars['category_name'] ) ? $vars['category_name'] : $vars['attachment'] ) );
- // $exists = $wpdb->get_var( $wpdb->prepare( "SELECT t.term_id FROM $wpdb->terms t LEFT JOIN $wpdb->term_taxonomy tt ON tt.term_id = t.term_id WHERE tt.taxonomy = 'product_cat' AND t.slug = %s" ,array( $slug )));
- // if( $exists ){
- // $old_vars = $vars;
- // $vars = array('product_cat' => $slug );
- // if ( !empty( $old_vars['paged'] ) || !empty( $old_vars['page'] ) )
- // $vars['paged'] = ! empty( $old_vars['paged'] ) ? $old_vars['paged'] : $old_vars['page'];
- // if ( !empty( $old_vars['orderby'] ) )
- // $vars['orderby'] = $old_vars['orderby'];
- // if ( !empty( $old_vars['order'] ) )
- // $vars['order'] = $old_vars['order'];
- // }
- // }
- // return $vars;
- // });
- add_filter('body_class', function (array $classes) {
- if (in_array('blog', $classes)) {
- unset($classes[ array_search('blog', $classes) ]);
- }
- return $classes;
- });
- function get_level2($category, $level = 0)
- {
- $children = get_terms('product_cat', [
- 'parent' => $category->term_id,
- 'hide_empty' => false,
- ]);
- if (!$children) {
- return $level;
- } else {
- $level++;
- $category = get_terms('product_cat', [
- 'parent' => $category->term_id,
- 'hide_empty' => false,
- ]);
- return get_level2($category[ 1 ], $level);
- }
- }
- add_action('after_setup_theme', 'woocommerce_support');
- function woocommerce_support()
- {
- load_theme_textdomain('IconicJew', get_template_directory() . '/languages');
- 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');
- }
- /**
- * Register our sidebars and widgetized areas.
- *
- */
- function arphabet_widgets_init()
- {
- register_sidebar([
- 'name' => 'Category filters',
- 'id' => 'cat_1',
- 'before_widget' => '<div class="amshopby-item-top block-content am-toggle-content"><dl id="narrow-by-list" class="amshopby-narrow-by-list widget %2$s">',
- 'after_widget' => '</dl></div>',
- 'before_title' => '<dt>',
- 'after_title' => '</dt>',
- ]);
- register_sidebar([
- 'name' => 'Category filters right',
- 'id' => 'cat_2',
- 'before_widget' => '<div class="amshopby-item-top block-content am-toggle-content"><dl id="narrow-by-list" class="amshopby-narrow-by-list widget %2$s">',
- 'after_widget' => '</dl></div>',
- 'before_title' => '<dt>',
- 'after_title' => '</dt>',
- ]);
- register_sidebar([
- 'name' => 'header',
- 'id' => 'cart_w',
- 'before_widget' => '<div class="header-cart">',
- 'after_widget' => '</div>',
- 'before_title' => '',
- 'after_title' => '',
- ]);
- register_sidebar([
- 'name' => 'Footer 1',
- 'id' => 'block_1',
- 'before_widget' => '<div id="block_1" class="footer-area">',
- 'after_widget' => '</div>',
- 'before_title' => '<h6>',
- 'after_title' => '</h6>',
- ]);
- register_sidebar([
- 'name' => 'Footer 2',
- 'id' => 'block_2',
- 'before_widget' => '<div id="block_2" class="footer-area">',
- 'after_widget' => '</div>',
- 'before_title' => '<h6>',
- 'after_title' => '</h6>',
- ]);
- register_sidebar([
- 'name' => 'Footer 3',
- 'id' => 'block_3',
- 'before_widget' => '<div id="block_3" class="footer-area">',
- 'after_widget' => '</div>',
- 'before_title' => '<h6>',
- 'after_title' => '</h6>',
- ]);
- register_sidebar([
- 'name' => 'Footer 4',
- 'id' => 'block_4',
- 'before_widget' => '<div id="block_4" class="footer-area">',
- 'after_widget' => '</div>',
- 'before_title' => '<h6>',
- 'after_title' => '</h6>',
- ]);
- }
- add_action('widgets_init', 'arphabet_widgets_init');
- function woo_custom_ajax_variation_threshold($qty, $product)
- {
- return 200;
- }
- add_filter('woocommerce_ajax_variation_threshold', 'woo_custom_ajax_variation_threshold', 10, 2);
- add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash');
- function woo_custom_hide_sales_flash()
- {
- return false;
- }
- function get_product_by_sku($sku)
- {
- global $wpdb;
- $product_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku));
- if ($product_id)
- return new WC_Product($product_id);
- return null;
- }
- //add_action('pmxi_saved_post', 'post_saved', 10, 1);
- function post_saved($id)
- {
- // ------------- WPML translator -------------------------
- //$id_d = apply_filters('wpml_object_id', $id, 'product', TRUE,'en');
- //$thubm_id =get_post_meta($id_d,'_thumbnail_id', true);
- //if($thubm_id==''){
- // $post = ['ID' => $id, 'post_status' => 'draft'];
- // wp_update_post($post);
- //}
- //else
- //{
- // add_post_meta( $id, '_thumbnail_id', $thubm_id);
- //}
- // ------------- end WPML translator -------------------------
- // ------------- import Comments -------------------------
- /*
- $comment_authors = get_post_meta($id, '_comment_auth', 'true');
- $comment_text = get_post_meta($id, '_comment_text', 'true');
- $comment_summary = get_post_meta($id, '_comment_summary', 'true');
- $comment_rating = get_post_meta($id, '_comment_rating', 'true');
- $commentdata = [
- 'comment_post_ID' => $id,
- 'comment_author' => $comment_authors,
- 'comment_content' => $comment_text,
- 'comment_type' => '',
- 'comment_parent' => 0,
- 'user_ID' => 0,
- ];
- $comment_id = wp_new_comment($commentdata);
- update_comment_meta($comment_id, 'rating', $comment_rating);
- update_comment_meta($comment_id, '_summary_review', $comment_summary);
- update_comment_meta($comment_id, 'verified', 0);
- wp_update_comment_count($id, true);
- */
- // ------------- end import Comments -------------------------
- // ------------- main import Products ----------------
- //$p1 = get_post_meta($id, '_video_name', true);
- //
- //$cat = get_post_meta($id, '_categories_ids', true);
- //$cat = explode(',', $cat);
- //$cat = array_map('intval', $cat);
- //$cat = array_unique($cat);
- //
- //if ($p1 != '') {
- //
- //
- // $wp_upload_dir = wp_upload_dir();
- // $filename = $wp_upload_dir[ 'basedir' ] . '/wpallimport/files/video/' . $p1;
- //
- // // The ID of the post this attachment is for.
- // $parent_post_id = $id;
- //
- // // Check the type of file. We'll use this as the 'post_mime_type'.
- // $filetype = wp_check_filetype(basename($filename), null);
- //
- // // Get the path to the upload directory.
- //
- // // Prepare an array of post data for the attachment.
- // $attachment = [
- // 'guid' => $wp_upload_dir[ 'url' ] . '/' . basename($filename),
- // 'post_mime_type' => $filetype[ 'type' ],
- // 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
- // 'post_content' => '',
- // 'post_status' => 'inherit',
- // ];
- //
- // // Insert the attachment.
- // $attach_id = wp_insert_attachment($attachment, $filename, $parent_post_id);
- //
- // // Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
- //
- //
- // // Generate the metadata for the attachment, and update the database record.
- // $attach_data = wp_generate_attachment_metadata($attach_id, $filename);
- // $video_id = time();
- // $video = [[
- // 'thumbn' => (string)get_post_thumbnail_id($parent_post_id),
- // 'id' => 'ywcfav_video_id-' . $video_id,
- // 'type' => 'upload',
- // 'featured' => 'featured',
- // 'name' => preg_replace('/\.[^.]+$/', '', basename($filename)),
- // 'host' => 'host',
- // 'content' => (string)$attach_id,
- // ]];
- // $video_featured = [
- // 'id' => 'ywcfav_video_id-' . $video_id,
- // 'type' => 'video',
- // ];
- // add_post_meta($id, '_ywcfav_video', $video);
- // add_post_meta($id, '_ywcfav_featured_content', $video_featured);
- //}
- //wp_set_object_terms($id, $cat, 'product_cat');
- //
- //if (get_post_meta($id, '_check_parent', true) == 'configurable') {
- // $post = ['ID' => $id, 'post_status' => 'draft'];
- // wp_update_post($post);
- //}
- // ------------- end main import Products ----------------
- }
- remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
- remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20);
- add_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 10);
- add_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 20);
- function filter_descr($post_post_excerpt)
- {
- return $post_post_excerpt;
- }
- add_action('woocommerce_short_description', 'filter_descr', 10, 1);
- function generateRandomString($length = 11)
- {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $charactersLength = strlen($characters);
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[ rand(0, $charactersLength - 1) ];
- }
- return $randomString;
- }
- add_filter('woocommerce_format_sale_price', 'custom_price_html', 100, 2);
- function custom_price_html($price, $product)
- {
- $price = preg_replace('/<del>/', '', $price);
- $price = preg_replace('/\<\/del>/', '', $price);
- $price = preg_replace('/<ins>/', '', $price);
- $price = preg_replace('/<\/ins>/', '', $price);
- $i = 1;
- $price = preg_replace('/woocommerce-Price-amount/', 'price old-price', $price, $i);
- $price = preg_replace('/woocommerce-Price-amount/', 'price special-price', $price, $i);
- return $price;
- }
- add_filter('woocommerce_product_tabs', 'woo_rename_tabs', 98);
- function woo_rename_tabs($tabs)
- {
- $tabs[ 'reviews' ][ 'title' ] = __('Product review'); // Rename the reviews tab
- $tabs[ 'additional_information' ][ 'title' ] = __('Product Details'); // Rename the additional information tab
- return $tabs;
- }
- add_filter('woocommerce_product_tabs', 'woo_new_product_tab');
- function woo_new_product_tab($tabs)
- {
- // Adds the new tab
- $tabs[ 'test_tab' ] = [
- 'title' => __('Your order includes', 'woocommerce'),
- 'priority' => 50,
- 'callback' => 'woo_new_product_tab_content',
- ];
- return $tabs;
- }
- function woo_new_product_tab_content()
- {
- // The new tab content
- echo '<h6>' . translate('Your Order Includes', 'IconicJew') . '</h6><ol><div class="oversized-h">' . translate('Your Order Includes', 'IconicJew') . '</div>';
- echo '<div style="padding:10px 0 25px 0; margin-bottom:20px;" class="your-order-include"><div style="background:#f9f9f9; overflow:auto;">';
- echo '<div style="width:29%; padding:2%; float:left;"><img src="' . get_template_directory_uri() . '/images/ordering.png" width="100%" height="auto"></div><div style="width:29%; padding:2%;float:left;"><h2 style="border:none;">' . translate('SHIPPING DETAILS', 'IconicJew') . '</h2>';
- echo '<p>' . translate('FREE insured shipping for all orders', 'IconicJew') . '</p><p></p><p>' . translate('Delivery time is around 16 days. 10 days for manufacturing and 6 days for expedite shipping.', 'IconicJew') . '</p></div>';
- echo '<div style="width:30%; padding:2%; float:left;">';
- echo '<div style="border:3px solid #304071; display:inline-block; margin:0 auto; padding:10px 30px 0 30px;" class="yoi">';
- echo '<p style="font-size:15px;" align="center">' . translate('YOUR ORDER INCLUDES', 'IconicJew');
- echo '</p><p align="left">';
- echo '•' . translate(' Free FedEx Shipping World Wide', 'IconicJew') . '<br>';
- echo '•' . translate(' Free 60 Day Returns', 'IconicJew') . ' <br>';
- echo '•' . translate(' Professional Appraisal', 'IconicJew') . '<br>';
- echo '•' . translate(' Complimentary Packaging', 'IconicJew') . '<br>';
- echo '</p></div></div></div></div></ol>';
- }
- function save_comment_meta_data($comment_id)
- {
- add_comment_meta($comment_id, '_summary_review', $_POST[ 'summary_review' ]);
- }
- add_action('comment_post', 'save_comment_meta_data');
- function ico_register_widgets()
- {
- register_widget('WC_Widget_Layered_Nav_Extended');
- register_widget('WC_Widget_Layered_Nav_Extended_2');
- register_widget('WC_Widget_Price_Filter_Ext');
- // register_widget('WooCommerce_Widget_DropdownCart');
- }
- add_action('widgets_init', 'ico_register_widgets');
- add_filter('loop_shop_per_page', 'get_per_page', 20);
- function get_per_page()
- {
- if (isset($_GET[ 'per_page' ]) && in_array($_GET[ 'per_page' ], [16, 32, 64])) {
- return $_GET[ 'per_page' ];
- } else {
- if (wp_is_mobile()) {
- return 16;
- }
- return 32;
- }
- }
- add_action('init', 'create_posttype');
- function create_posttype()
- {
- register_post_type('education_post',
- [
- 'labels' => [
- 'name' => __('Education'),
- 'singular_name' => __('Education'),
- ],
- 'public' => true,
- 'hierarchical' => true,
- 'has_archive' => true,
- 'rewrite' => ['slug' => 'education'],
- 'supports' => ['page-attributes', 'title', 'editor'],
- ]
- );
- }
- add_action('wp_ajax_nopriv_get-diff-prod', 'get_prod');
- add_action('wp_ajax_get-diff-prod', 'get_prod');
- function get_prod()
- {
- $sku = $_POST[ 'data' ][ 'sku' ];
- $metal = $_POST[ 'data' ][ 'Metal' ];
- if ($_POST[ 'data' ][ 'Gemstone' ]) {
- $Gemstone = $_POST[ 'data' ][ 'Gemstone' ];
- }
- if ($_POST[ 'data' ][ 'Center_stone' ]) {
- $center_stone = $_POST[ 'data' ][ 'Center_stone' ];
- }
- $query_args = [
- 'post_type' => 'product',
- 'post_status' => 'publish',
- 'meta_query' => [
- [ // restrict posts based on meta values
- 'key' => '_parent_prod',
- 'value' => $sku,
- 'compare' => '='],
- ],
- 'tax_query' => [
- [
- 'taxonomy' => 'pa_ring-metal',
- 'field' => 'slug',
- 'terms' => $metal,
- ],
- ],
- ];
- if ($center_stone != '') {
- $query_args[ 'tax_query' ] = [
- 'relation' => 'AND',
- [
- 'taxonomy' => 'pa_center-stone',
- 'field' => 'slug',
- 'terms' => $center_stone,
- ],
- [
- 'taxonomy' => 'pa_ring-metal',
- 'field' => 'slug',
- 'terms' => $metal,
- ],
- ];
- }
- if ($Gemstone != '') {
- $query_args[ 'tax_query' ] = [
- 'relation' => 'AND',
- [
- 'taxonomy' => 'pa_accent-stones',
- 'field' => 'slug',
- 'terms' => $Gemstone,
- ],
- [
- 'taxonomy' => 'pa_ring-metal',
- 'field' => 'slug',
- 'terms' => $metal,
- ],
- ];
- }
- $query = new WP_QUERY($query_args);
- while ($query->have_posts()):$query->the_post();
- $link = get_permalink();
- endwhile;
- // не забываем завершать PHP
- echo $link;
- wp_die();
- }
- //add_filter('show_admin_bar', '__return_false');
- //Store the custom field
- add_filter('woocommerce_add_cart_item_data', 'add_cart_item_custom_data_vase', 10, 2);
- function add_cart_item_custom_data_vase($cart_item_meta, $product_id)
- {
- global $woocommerce;
- if (isset($_POST[ 'select_country' ]))
- $cart_item_meta[ 'select_country' ] = $_POST[ 'select_country' ];
- if (isset($_POST[ 'select_s' ]))
- $cart_item_meta[ 'select_s' ] = $_POST[ 'select_s' ];
- if (isset($_POST[ 'certificate' ]))
- $cart_item_meta[ 'certificate' ] = $_POST[ 'certificate' ];
- return $cart_item_meta;
- }
- //Get it from the session and add it to the cart variable
- function get_cart_items_from_session($item, $values, $key)
- {
- if (array_key_exists('select_country', $values))
- $item[ 'Ring_Country' ] = $values[ 'select_country' ];
- if (array_key_exists('select_s', $values))
- $item[ 'Ring_Size' ] = $values[ 'select_s' ];
- if (array_key_exists('certificate', $values))
- $item[ 'Certificate' ] = $values[ 'certificate' ];
- return $item;
- }
- add_filter('woocommerce_get_cart_item_from_session', 'get_cart_items_from_session', 1, 3);
- function iconic_add_engraving_text_to_order_items( $item, $cart_item_key, $values, $order ) {
- if ( !empty( $values['Ring_Country'] ) ) {
- $item->add_meta_data( __( 'Ring Country', 'IconicJew' ), $values['Ring_Country'] );
- }
- if ( !empty( $values['Ring_Size'] ) ) {
- $item->add_meta_data( __( 'Ring Size', 'IconicJew' ), $values['Ring_Size'] );
- }
- if ( !empty( $values['Certificate'] ) ) {
- $item->add_meta_data( __( 'Certificate', 'IconicJew' ), $values['Certificate'] );
- }
- }
- add_action( 'woocommerce_checkout_create_order_line_item', 'iconic_add_engraving_text_to_order_items', 10, 4 );
- function so_validate_add_cart_item( $passed, $product_id, $quantity, $variation_id = '', $variations= '' ) {
- global $woocommerce;
- $option = 'select_s';
- // do your validation, if not met switch $passed to false
- if(get_post_meta($product_id, '_type_of_product', true) == 'Ring'){
- if(!isset($_POST['select_s'])) {
- $passed = false;
- }
- }
- if (!$passed) {
- wc_add_notice( __( 'You need to select size', 'textdomain' ), 'error' );
- }
- return $passed;
- }
- add_filter( 'woocommerce_add_to_cart_validation', 'so_validate_add_cart_item', 10, 5 );
- function woocommerce_add_to_cart_validation_custom($passed, $product_id, $qty){
- global $woocommerce;
- $option = 'Ring_size'; // your custom field's name
- if (!$passed)
- $woocommerce->add_error( sprintf( __('"%s" is a required field.', 'woocommerce'), $option) );
- return $passed;
- }
- add_action('wp_ajax_nopriv_load-search', 'prefix_load_search');
- add_action('wp_ajax_load-search', 'prefix_load_search');
- function prefix_load_search()
- {
- $search_string = sanitize_text_field($_POST[ 'search' ]);
- $args = [
- 'post_type' => 'product',
- 'post_status' => 'published',
- 's' => $search_string,
- 'posts_per_page' => 3,
- ];
- $query = new WP_Query($args);
- ob_start();
- echo '<ul>';
- while ($query->have_posts()):$query->the_post();
- $id = get_the_ID();
- $product_wc = wc_get_product($id);
- echo '<li data-url="' . get_permalink() . '">' .
- '<div class="searchautocomlete-image">' .
- get_the_post_thumbnail($id, [50, 50]) .
- '</div>' .
- '<a class="name highlight" href="' . get_permalink() . '">' . get_the_title() . '</a>' .
- '<div class="price-box">' .
- $product_wc->get_price_html() .
- '</div>' .
- '<div class="clearfix"></div>' .
- '</li>';
- endwhile;
- echo '</ul>';
- $response = ob_get_contents();
- ob_end_clean();
- echo json_encode([
- 'data' => $response,
- ]);
- die(1);
- }
- add_action('wp_ajax_nopriv_load-filter2', 'prefix_load_term_posts');
- add_action('wp_ajax_load-filter2', 'prefix_load_term_posts');
- function prefix_load_term_posts()
- {
- /*
- $massive['relation'] = 'OR';
- foreach($_POST['data'] as $data){
- $massive[]=array(
- 'taxonomy'=>$data['attr'],
- 'field' => 'slug',
- 'terms' => $data['slug']
- );
- }
- $args = array(
- 'post_type' => 'product',
- 'post_status' => 'publish',
- 'posts_per_page' =>(isset($_POST['per_page_n'])?$_POST['per_page_n']:32),
- 'paged' => $_POST['page'],
- 'tax_query'=> array(
- 'relation' => 'AND',
- array(
- 'taxonomy' => 'product_cat',
- 'field' => 'id',
- 'terms' => $_POST['category']
- ),
- $massive
- )
- );*/
- global $WOOCS;
- $currencies = $WOOCS->get_currencies();
- $cur_cur = $currencies[ $_POST[ 'curency' ] ][ 'rate' ];
- $massive = [];
- foreach ($_POST[ 'data' ] as $data) {
- $massive[ $data[ 'attr' ] ][] = [
- 'taxonomy' => $data[ 'attr' ],
- 'field' => 'slug',
- 'terms' => $data[ 'slug' ],
- ];
- //if (count($massive[ $data[ 'attr' ] ]) == 2) {
- $massive[ $data[ 'attr' ] ][ 'relation' ] = 'OR';
- //}
- }
- if (array_key_exists('pa_center-stone', $massive) && array_key_exists('pa_accent-stones', $massive)) {
- $massive[ 'pa_center-stone' ] = array_merge($massive[ 'pa_center-stone' ], $massive[ 'pa_accent-stones' ]);
- unset($massive[ 'pa_accent-stones' ]);
- }
- $massive = array_values($massive);
- $tax_query = array_merge([
- 'relation' => 'AND',
- [
- 'taxonomy' => 'product_cat',
- 'field' => 'id',
- 'terms' => $_POST[ 'category' ],
- ]], $massive);
- $args = [
- 'post_type' => 'product',
- 'post_status' => 'publish',
- 'posts_per_page' => (isset($_POST[ 'per_page_n' ]) ? $_POST[ 'per_page_n' ] : 32),
- 'paged' => $_POST[ 'page' ],
- 'suppress_filters'=>false,
- 'tax_query' =>
- $tax_query,
- ];
- if ($_POST[ 'sort_by' ] == 'random_order') {
- $args[ 'orderby' ] = 'rand';
- }
- if ($_POST[ 'sort_by' ] == 'date') {
- $args[ 'orderby' ] = 'date';
- }
- if ($_POST[ 'sort_by' ] == 'price') {
- $args[ 'order' ] = 'ASC';
- $args[ 'orderby' ] = 'meta_value_num';
- $args[ 'meta_key' ] = '_price';
- }
- if ($_POST[ 'sort_by' ] == 'price-desc') {
- $args[ 'orderby' ] = 'meta_value_num';
- $args[ 'meta_key' ] = '_price';
- }
- if ($_POST[ 'sort_by' ] == 'popularity') {
- $args[ 'orderby' ] = 'total_sales';
- }
- if ($_POST[ 'priceT' ] || $_POST[ 'priceF' ]) {
- if ($_POST[ 'priceT' ]) {
- $max = intval($WOOCS->back_convert($_POST[ 'priceT' ], $cur_cur, 2));
- } else {
- $max = 99999999;
- }
- if ($_POST[ 'priceF' ]) {
- $min = intval($WOOCS->back_convert($_POST[ 'priceF' ], $cur_cur, 2));
- } else {
- $min = 0;
- }
- $args[ 'meta_query' ] = [
- 'relation' => 'AND',
- [
- 'key' => '_price',
- 'value' => $min,
- 'compare' => '>=',
- 'type' => 'DECIMAL',
- ],
- [
- 'key' => '_price',
- 'value' => $max,
- 'compare' => '<=',
- 'type' => 'DECIMAL',
- ],
- ];
- // $args['meta_key']='_price';
- // $args['meta_value']=array($min,$max);
- // $args['meta_compare']='BETWEEN';
- }
- $query = new WP_QUERY($args);
- ob_start();
- while ($query->have_posts()): $query->the_post();
- wc_get_template_part('content', 'product');
- endwhile;
- $response = ob_get_contents();
- ob_end_clean();
- $paged = max(1, $query->get('paged'));
- $per_page = $query->get('posts_per_page');
- $total = $query->found_posts;
- $first = ($per_page * $paged) - $per_page + 1;
- $last = min($total, $query->get('posts_per_page') * $paged);
- /* translators: 1: first result 2: last result 3: total results */
- $count = sprintf('Showing <span id="showfrom"> 1 </span> to <span id="showto"> %2$d </span> of <span id="showall"> %3$d </span> items', $first, $last, $total);
- $pagin = preg_replace('/ul/', 'ol', paginate_links(apply_filters('woocommerce_pagination_args', [
- 'base' => esc_url_raw(str_replace(999999999, '%#%', remove_query_arg('add-to-cart', get_pagenum_link(999999999, false)))),
- 'format' => '',
- 'add_args' => false,
- 'current' => max(1, $_POST[ 'page' ]),
- 'total' => $query->max_num_pages,
- 'prev_text' => '←',
- 'next_text' => '→',
- 'type' => 'list',
- 'end_size' => 0,
- 'mid_size' => 2,
- ])));
- //echo $response;
- $from = (isset($_POST[ 'per_page_n' ]) ? $_POST[ 'per_page_n' ] : 32) * ($_POST[ 'page' ] - 1) + 1;
- if ($query->max_num_pages == $_POST[ 'page' ]) {
- $to = ($query->found_posts % (isset($_POST[ 'per_page_n' ]) ? $_POST[ 'per_page_n' ] : 32)) + $from - 1;
- } else {
- $to = (isset($_POST[ 'per_page_n' ]) ? $_POST[ 'per_page_n' ] : 32) * ($_POST[ 'page' ]);
- }
- echo json_encode(['count' => $query->found_posts,
- 'data' => $response,
- 'pagin' => $pagin,
- 'from' => $from,
- 'to' => $to,
- 'args' => $count,
- 'cur' => $cur_cur,
- 'query' => $query,
- 'min-max' => [$min, $max]]);
- die(1);
- }
- add_action('wp_head', 'remove_my_action');
- function remove_my_action()
- {
- remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination');
- add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20);
- add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 30);
- remove_action('woocommerce_before_checkout_form', 'woocommerce_checkout_login_form');
- remove_action('woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form');
- remove_action('woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20);
- add_action('woocommerce_checkout_payment_form', 'woocommerce_checkout_payment');
- //remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form' );
- //add_action('woocommerce_checkout_shipping', 'woocommerce_checkout_coupon_form' , 30);
- }
- add_filter('woocommerce_checkout_fields', 'webendev_woocommerce_checkout_fields');
- function webendev_woocommerce_checkout_fields($fields)
- {
- $fields[ 'order' ][ 'order_comments' ][ 'placeholder' ] = __('Enter text to be engraved (up to 15 characters, standard numbers and letters only)','IconicJew');
- $fields[ 'order' ][ 'order_comments' ][ 'label' ] = __('Optional: Add Engraving','IconicJew');
- return $fields;
- }
- add_action('woocommerce_before_calculate_totals', 'sv_change_product_price_cart', 80, 1);
- function sv_change_product_price_cart($cart_object)
- {
- if (is_admin() && !defined('DOING_AJAX'))
- return;
- foreach ($cart_object->get_cart() as $cart_item) {
- if (isset($cart_item[ 'Certificate' ]) and ($cart_item[ 'Certificate' ] == 'on')) {
- $old_price = $cart_item[ 'data' ]->get_price();
- $price = $old_price + 30;
- $cart_item[ 'data' ]->set_price($price);
- $cart_item[ 'Certificate_2' ] = 'yes';
- }
- }
- }
- add_filter('wp_nav_menu_items', 'your_custom_menu_item', 10, 2);
- function your_custom_menu_item($items, $args)
- {
- if (is_object($args->menu) && ($args->menu->term_id == 1324)) {
- $items .= '<li><div data-id="cc28f4f859" class="livechat_button" style="display:inline; text-transform:capitalize;"><a href="http://www.livechatinc.com/customer-service-software/?partner=lc_2267311&utm_source=chat_button"></a></div></li>';
- }
- return $items;
- }
- function drop_hint_message($prod_id, $name, $email, $message, $recipients)
- {
- $product = wc_get_product($prod_id);
- $multiple_recipients = [get_option('admin_email')];
- foreach ($recipients as $recipient) {
- $multiple_recipients[] = $recipient[ 'email' ];
- }
- $subject = $product->get_title();
- $body = 'The email body content';
- $headers = ['Content-Type: text/html; charset=UTF-8', 'From: ' . $name . ' <' . $email . '>'];
- $action = wp_mail($multiple_recipients, $subject, $body, $headers);
- return $action;
- }
- function drop_hint_message_pop($prod_id, $name, $email, $recipient_name, $recipient_email)
- {
- $product = wc_get_product($prod_id);
- $multiple_recipients = [get_option('admin_email'), $recipient_email];
- $subject = $product->get_title();
- $link = get_permalink($prod_id);
- $body = 'Dear ' . $recipient_name . ',<br><br>' .
- 'The team at Iconic have found out ' . $name . ' hopes to empower women around the world.' .
- 'This can only happen with your help. 100% of the profits from Iconic Jewellery supports women starting businesses,' .
- 'going to school, leading their communities and building strong families.' .
- 'Help make the gift even more special with our free engraving service.<br><br> ' .
- '<a href="' . $link . '">Discover the item here*</a>';
- $headers = ['Content-Type: text/html; charset=UTF-8', 'From: ' . $name . ' <' . $email . '>'];
- $action = wp_mail($multiple_recipients, $subject, $body, $headers);
- return $action;
- }
- add_action('wp_ajax_nopriv_drop-submit', 'prefix_drop_submit');
- add_action('wp_ajax_drop-submit', 'prefix_drop_submit');
- function prefix_drop_submit()
- {
- $action = drop_hint_message_pop($_POST[ 'form' ][ 'prod_id' ], $_POST[ 'form' ][ 'sender_n' ], $_POST[ 'form' ][ 'sender_e' ], $_POST[ 'form' ][ 'recipient_n' ], $_POST[ 'form' ][ 'recipient_e' ]);
- if ($action) {
- $status = 'success';
- $message = 'Your email was sent successfully';
- } else {
- $status = 'failure';
- $message = 'There was an error trying to send your message. Please try again later.';
- }
- echo json_encode([
- 'status' => $status,
- 'message' => $message]);
- die();
- }
- //function myplugin_wpml_ls_dirs_to_scan( $dirs ) {
- // $folder_name = basename( dirname( __FILE__ ) );
- // $dirs[] = trailingslashit( WP_PLUGIN_DIR ) . $folder_name . '/templates/';
- // return $dirs;
- //}
- //add_filter( 'wpml_ls_directories_to_scan', 'myplugin_wpml_ls_dirs_to_scan' );
- function icl_post_languages_2()
- {
- //$languages = icl_get_languages('skip_missing=1');
- //if (1 < count($languages)) {
- // echo "<select id=\"select-language\" title=\"Your Language\" onchange=\"window.location.href=this.value\">";
- // foreach ($languages as $l) {
- // if (!$l[ 'active' ]) {
- // $langs[] = '<option value="' . $l[ 'url' ] . '">' . $l[ 'native_name' ] . '</option>';
- // } else {
- // $langs[] = '<option selected value="' . $l[ 'url' ] . '">' . $l[ 'native_name' ] . '</option>';
- // }
- // }
- //
- // echo join(', ', $langs);
- // echo "</select>";
- //}
- }
- function sv_change_product_price_display($price)
- {
- if (is_product()) {
- $price2 = str_replace_nth('<\/span>', ' </span><p class="in-store">'.__('In-Store Price','IconicJew').'</p> </span>', $price, 1);
- $price2 = str_replace_nth('amount\">', 'amount"><span>', $price2, 0);
- return str_replace_nth('<\/span>', ' <p class="in-store">'.__('Online Price','IconicJew').'</p></span> ', $price2, 4);
- }
- return $price;
- }
- function str_replace_nth($search, $replace, $subject, $nth)
- {
- $found = preg_match_all('/' . $search . '/', $subject, $matches, PREG_OFFSET_CAPTURE);
- if (false !== $found && $found > $nth) {
- return substr_replace($subject, $replace, $matches[ 0 ][ $nth ][ 1 ], strlen($search) - 1);
- }
- return $subject;
- }
- add_filter('woocommerce_get_price_html', 'sv_change_product_price_display');
- add_filter('woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby');
- add_filter('woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby');
- function custom_woocommerce_catalog_orderby($sortby)
- {
- $sortby[ 'random_order' ] = 'Random';
- return $sortby;
- }
- function sv_alphabetical_woocommerce_shop_ordering( $sort_args ) {
- $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
- if ( 'random_order' == $orderby_value ) {
- $sort_args['orderby'] = 'rand';
- }
- return $sort_args;
- }
- add_filter( 'woocommerce_get_catalog_ordering_args', 'sv_alphabetical_woocommerce_shop_ordering' );
- function get_original_cf($postid = 0, $element_type = 'post', $key)
- {
- global $sitepress, $post;
- $postid = ($postid == 0 ? $post->ID : $postid);
- $custom_field = get_post_meta(icl_object_id($postid, $element_type, false, $sitepress->get_default_language()), $key, true);
- return $custom_field;
- }
- add_action('woocommerce_product_query', 'test_query');
- function test_query($query)
- {
- if (is_product_category()) {
- $query->query = ['product_cat' => $query->query[ 'product_cat' ]];
- if (array_key_exists(0,$query->tax_query->queries)){
- $query->tax_query->queries = [$query->tax_query->queries[ 0 ]];
- }
- if (array_key_exists(0,$query->tax_query->queried_terms)){
- $query->tax_query->queried_terms = [$query->tax_query->queried_terms[ 0 ]];
- }
- $qv = $query->query_vars;
- foreach ($_GET as $key => $value) {
- unset($qv[ $key ]);
- }
- $query->query_vars = $qv;
- }
- return $query;
- }
- function isa_comment_reform ($arg) {
- $arg['title_reply'] = __('Leave a review :');
- return $arg;
- }
- add_filter('comment_form_defaults','isa_comment_reform');
- function alx_html_js_class () {
- echo '<script>document.documentElement.className = document.documentElement.className.replace("no-js","js");</script>'. "\n";
- }
- add_action( 'wp_head', 'alx_html_js_class', 1 );
- function cc_mime_types($mimes) {
- $mimes['svg'] = 'image/svg+xml';
- return $mimes;
- }
- add_filter('upload_mimes', 'cc_mime_types');
- function jewellery_jewelry($attr) {
- return '<span style="text-transform:'.$attr['style'].'">'.strtolower(HOME_TITLE).'</span>';
- }
- add_shortcode( 'jewellery', 'jewellery_jewelry' );
- add_filter('wpseo_title','change_in_titles');
- function change_in_titles($string){
- if(HOME_TITLE=='JEWELLERY'){
- $string = str_replace('Jewelry','Jewellery',$string);
- }
- else{
- $string = str_replace('Jewellery','Jewelry',$string);
- }
- return $string;
- }
- function my_get_the_product_thumbnail_url( $size = 'shop_catalog' ) {
- global $post;
- $image_size = apply_filters( 'single_product_archive_thumbnail_size', $size );
- return get_the_post_thumbnail_url( $post->ID, $image_size );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement