Aleš Sýkora wrote

Featured products query WooCommerce

11. 4. 2021 in

If you are using your own queries for WooCommerce stores, for example in Oxygen builder’s custom code block then you may need query for featured products.

You can use the query I am using inside my product sliders :-).

<div class="category-slider-big">

		$args = array(
			'post_type' => 'product',
           	'post_status' => 'publish',
			'posts_per_page' => 12,
          'tax_query' => array( array(
            'taxonomy' => 'product_visibility',
            'field'    => 'term_id',
            'terms'    => 'featured',
            'operator' => 'IN',
        ) )
		$loop = new WP_Query( $args );
		if ( $loop->have_posts() ) {
			while ( $loop->have_posts() ) : $loop->the_post();
          $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'medium_large'); 
          $permalink = get_permalink(get_the_ID());

                      <div class="category-slider-big-cell c-padding-xs">
                <a href="<?php echo $permalink ?>">
                  <div class="c-transititon c-text-s baskerville text-up c-text-dark category-slider-text c-padding-xs"><?php the_title(); ?></div>
                  <img class="category-image" src="<?php echo $featured_img_url; ?>">

		} else {
			echo __( 'No products found' );

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
Fluent Forms activation – You do not have sufficient permissions to access this page.
25. 3. 2021 in
If you got “You do not have sufficient permissions to access this page.” error when you click on activation of Fluent Forms Pro licence, you need to go to the integration modules settings of Fluent Forms plugin and activate the plugin from there.
Read More
Aleš Sýkora wrote
Oxygen Pro Menu Entire Parent Toggle Dropdown not working
22. 3. 2021 in ,
If you want to have your dropdowns shown in mobile menu with toggle, you are propably using Oxygen’s Pro menu option “Entire Parent Toggles Dropdown”. And it works fine, in most cases. But there is an issue with custom links. If your link uses # then this option doesn’t work. You need to use /# […]
Read More
Aleš Sýkora wrote
Bootstrap 4 button line break
11. 11. 2019 in
Break the line of long text in Bootstrap 4 button on mobile device.
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram