mattmikulla
Member
Posted 6 months ago #
I want to create a featured box on my home page that displays the latest featured product.
The catch is I want this image to use the single product image (large) and not a catalog image thumbnail.
Having the excerpt and link to product page would be ideal as well.
I asked at the support forum and all they told me was beyond the shortcodes available a custom solution is necessary.
This is a pretty big functionality oversight in my opinion.
Any ideas on how to achieve this?
http://wordpress.org/extend/plugins/woocommerce/
Hi Matt,
Its not really a functionality oversight because its easily done through a custom loop, if you know what your doing. You do it exactly the same way as you would with posts.
http://codex.wordpress.org/Class_Reference/WP_Query
$my_query = new WP_Query( array(
'post_status' => 'publish',
'post_type' => 'product',
'meta_key' => 'featured',
'meta_value' => 'yes',
'posts_per_page => 1
) );
if ($my_query ->have_posts()) : while ($my_query ->have_posts()) : $my_query ->the_post();
// Output your product here...
endwhile;
endif;
Mike
mattmikulla
Member
Posted 6 months ago #
Thanks.
I asked on the support forum and didn't get any specifics.
Could you please give me a functioning code example?
jameskoster
Member
Posted 6 months ago #
You'd probably get a much better response if you stopped claiming that your own personal requirements not being part of the core plugin are a 'big oversight'.
Just my 2c :-P
lloydo3000
Member
Posted 3 months ago #
I don't really know what I'm doing so it's taken me a lot of fiddling to get it going. I finally have my featured products loop working, but only after I changed the 'meta_key' => '_featured' -- note the underscore there.
This problem might exist in WooStore as well, but I thought I'd reply to this topic in public in case someone wonders why Mike's snippet isn't working. Consider it a 2c refund :-b
pyarasujal
Member
Posted 1 month ago #
Hi Guys,
Thanks for sharing your experience. Actually I want to display featured products with thumbnail. Can you please let me know the code for the thumbnainl?
Thanks in advance.