Add dynamic schema product, aggregate Rating to WooCommerce products

$raiting = wp_count_posts()->publish + 112; if($raiting==»») {return;} global $product; $img = wp_get_attachment_url( get_post_thumbnail_id($post_id), ‘thumbnail’ ); if($img==»») {$img = ‘/wp-content/uploads/2024/05/share.jpg’ ;} $title = $product->name; $descr =the_content(); $url = get_permalink(); $reviewCnt = round($raiting / 4); echo ‘ <script type=»application/ld+json»> { «@context»: «http://schema.org/», «@type»: «product», «name»: «‘ . $title . ‘», «brand»: «…», «image»: «‘ . $img . […]

Add dynamic schema product, aggregate Rating to WooCommerce products Читать далее »

Disable billing fields in woocommerce checkout (Gutenberg blocks)

add_filter( ‘woocommerce_get_country_locale’, function ( $locale ) { $cart = WC()->cart; // Only remove fields if we have a cart. if ( ! $cart ) { return $locale; } // If cart requires shipping, then it’s likely paid and isn’t calculated yet. if ( $cart->needs_shipping() ) { return $locale; } // Only remove fields if the

Disable billing fields in woocommerce checkout (Gutenberg blocks) Читать далее »

EWWW Image Optimizer — Preload featured image WebP

function preload_featured_image() { global $post; $featured_image_url = get_the_post_thumbnail_url($post->ID, ‘full’); if ($featured_image_url) { $path = parse_url($featured_image_url, PHP_URL_PATH); $file_path = $_SERVER[‘DOCUMENT_ROOT’] . $path; $webp_file_path = str_replace(‘.jpg’, ‘.jpg.webp’, $file_path); if (file_exists($webp_file_path)) { $webp_image_url = str_replace(‘.jpg’, ‘.jpg.webp’, $featured_image_url); echo ‘<link rel=»preload» href=»‘ . esc_url($webp_image_url) . ‘» as=»image» type=»image/webp» />’; } else { echo ‘<link rel=»preload» href=»‘ . esc_url($featured_image_url) .

EWWW Image Optimizer — Preload featured image WebP Читать далее »

Hide woocommerce zero price product and related products wiget

function hide_zero_price_products( $query ) { if ( is_woocommerce() && $query->is_main_query() ) { $query->set( ‘meta_query’, array( array( ‘key’ => ‘_regular_price’, ‘compare’ => ‘>’, ‘value’ => 0, ), ) ); } } add_action( ‘woocommerce_product_query’, ‘hide_zero_price_products’ ); add_filter( ‘woocommerce_related_products_args’, function( $args ) { unset( $args[‘post__in’] ); $args[‘meta_query’] = array( ‘key’ => ‘_regular_price’, ‘compare’ => ‘>’, ‘value’ => 0,

Hide woocommerce zero price product and related products wiget Читать далее »

CharGPT

I want you to enhance this [PROMPT] making it more detailed and specific for better output from ChatGPT. [PROMPT] = Do not execute the prompt. — I will give you a keyword, please search this keyword in Google, browse the titles and meta descriptions of each content on the homepage, and tell me what questions

CharGPT Читать далее »

Automatic Add FAQ shemma (JetEngine)

$post_id = get_the_ID(); $repeater = get_post_meta( $post_id, ‘faqshema’, true); if (!empty($repeater)) { $cnt = count($repeater); echo ‘ <script type=»application/ld+json»> { «@context»: «https://schema.org», «@type»: «FAQPage», «mainEntity»: [ ‘; foreach($repeater as $one){ echo ‘ { «@type»: «Question», «name»: «‘; echo $one[‘question’]; echo ‘», «acceptedAnswer»: { «@type»: «Answer», «text»: «‘; echo $one[‘answer’]; echo ‘» } }’; if($cnt >

Automatic Add FAQ shemma (JetEngine) Читать далее »

Get category and subcategory + sorting by custom meta field / bricksultimate

// cat $term = get_queried_object(); $args = []; if( $term ) { $args = [ ‘taxonomy’ => $term->taxonomy, ‘parent’ =>false, ‘hide_empty’ => false, ‘meta_key’ => ‘cat_eq_order’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’ ]; } return $args; //subcat $term = get_queried_object(); $args = []; if( $term ) { $args = [ ‘taxonomy’ => $term->taxonomy, ‘parent’ =>

Get category and subcategory + sorting by custom meta field / bricksultimate Читать далее »

Get woo product and atribut by product category except current product

<?php global $product; $current_product_id = $product->get_id(); $category_id = get_product_cat_id(); // Replace with desired category ID $args = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, ‘terms’ => $category_id, ‘operator’ => ‘IN’, ), ), ‘post__not_in’ => array( $current_product_id ), ); $query = new WP_Query(

Get woo product and atribut by product category except current product Читать далее »

Language Locale Overwrite for WordPress

This lightweight SEO plugin for WordPress allows changing the default HTML lang attribute globally, and on individual Posts and Pages. Along with cross-referencing similar Posts/Pages in different Languages using Alternate Hreflang tags. The Plugin is mostly of use when your WordPress blog contains a mix of languages with individual Posts/Pages, and you do not want to

Language Locale Overwrite for WordPress Читать далее »

Send email to customer when woocommerce order status changed

add_action(«woocommerce_order_status_changed», «my_awesome_publication_notification»); function my_awesome_publication_notification($order_id, $checkout=null) { global $woocommerce; $order = new WC_Order( $order_id ); if($order->status === ‘completed’ ) { // Create a mailer $mailer = $woocommerce->mailer(); $message_body = __( ‘Your track number:’ . $order->get_billing_company() ); $message = $mailer->wrap_message( // Message head and message body. sprintf( __( ‘Order %s received’ ), $order->get_order_number() ), $message_body ); //

Send email to customer when woocommerce order status changed Читать далее »

Get payment gateway data saved in Woocommerce payment settings

// HERE define you payment gateway ID (from $this->id in your plugin code) $payment_gateway_id = ‘bacs’; // Get an instance of the WC_Payment_Gateways object $payment_gateways = WC_Payment_Gateways::instance(); // Get the desired WC_Payment_Gateway object $payment_gateway = $payment_gateways->payment_gateways()[$payment_gateway_id]; // Display saved Settings example: echo ‘<p>Title: ‘ . $payment_gateway->title . ‘</p>’; echo ‘<p>Description: ‘ . $payment_gateway->description . ‘</p>’;

Get payment gateway data saved in Woocommerce payment settings Читать далее »

Disable Payment Method for Specific products Category / Вимкнути спосіб оплати для певної категорії продуктів

add_filter( ‘woocommerce_available_payment_gateways’, ‘bbloomer_unset_gateway_by_category’ ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( ! is_checkout() ) return $available_gateways; $unset = false; $category_id = 8; // TARGET CATEGORY foreach ( WC()->cart->get_cart_contents() as $key => $values ) { $terms = get_the_terms( $values[‘product_id’], ‘product_cat’ ); foreach ( $terms as $term ) { if (

Disable Payment Method for Specific products Category / Вимкнути спосіб оплати для певної категорії продуктів Читать далее »

Modify importing data while plugin WordPress Import Export work

1. Add function on function.php or other method: function increase_price( $data = [],$content=»» ) { $data1= isset( $data[ «price_in» ] ) ? $data[ «price_in» ] : 1; return $data1 * 1.08; } 2. In field add shortcod: [wpie_function custom_function=»increase_price» price_in=»{price[1]}»]   More info — https://plugins.vjinfotech.com/wordpress-import-export/documentation/add-shortcode/

Modify importing data while plugin WordPress Import Export work Читать далее »

Прокрутить вверх