get_the_post_thumbnail_url does not return anything if image size is set

The first parameter for get_the_post_thumbnail_url() is the post ID or post object, and not the image size which is actually the second parameter. So: // Instead of this: get_the_post_thumbnail_url( ‘thumbnail’ ) // You should use: get_the_post_thumbnail_url( get_the_ID(), ‘thumbnail’ ) // pass a post ID get_the_post_thumbnail_url( get_post(), ‘thumbnail’ ) // or post object // Or you … Read more

Search in 1) Post, 2) Products (woocommerce) and 3) Custom post type or Taxonomy type on a single page

I believe you cannot achieve it in the same loop. Instead, you should have three loops, each setting WP_Query criteria differently (setting WP_Query arguments to filter for Post, Products and Custom Taxonomy). Howevery, you want to save initial search parameters in variable(s), so you could apply them to those three different loops as other parts … Read more

Woocommerce – Problem sorting and filtering products with different tax rates by price [closed]

Wasn’t able to find any solution to my problem so I made a simple plugin: <?php /** * Plugin Name: calisia-sort-and-filter * Author: Tomasz Boroń */ //order by; add new options and remove defaults add_filter( ‘woocommerce_default_catalog_orderby_options’, ‘calisia_sort_and_filter::add_new_postmeta_orderby’ ); add_filter( ‘woocommerce_catalog_orderby’, ‘calisia_sort_and_filter::add_new_postmeta_orderby’ ); //order by; arguments add_filter( ‘woocommerce_get_catalog_ordering_args’, ‘calisia_sort_and_filter::add_postmeta_ordering_args’ ); //price filtering add_action(‘woocommerce_product_query’, ‘calisia_sort_and_filter::min_max_price_handler’); //save meta … Read more

Unable to pull in custom product attribute in shortcode [closed]

In case anyone needs it, here was my final code: <?php //LIST ALL DOCUMENTS add_shortcode(‘listDocs’,’listDocs’); function listDocs(){ $params = array( ‘paged’ => get_query_var(‘paged’, 1), ‘posts_per_page’ => 25, ‘post_type’ => ‘product’, ‘product_cat’ => ‘documents’ ); $wc_query = new WP_Query($params); while ($wc_query->have_posts()) { $wc_query->the_post(); $product_id = get_the_ID(); $product = wc_get_product($product_id); $author = $product->get_attribute(‘written-by’); $date = get_the_date(‘F Y’, … Read more

Remove WooCommerce block styles

The dequeue handle is incorrect it should be wp_dequeue_style(‘wc-block-style’); and not wp_dequeue_style(‘wc-block-style-css’); A bit confusing at first i agree, every js and css that was enqued via wp_enqueue_style or wp_enqueue_script gets a suffix of css/js Example wp_enqueue_style(‘swiper’, ‘https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.4.6/css/swiper.min.css’) This will create a <link> with an id attribute of swiper-css, im guessing this is why you … Read more