Created
March 25, 2022 12:39
-
-
Save ABooooo/5331cc9251464bb2bb87acd5ae6b2696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'product', | |
'product_cat' => 'klaviere', | |
'posts_per_page' => 3, | |
'orderby' => 'date', | |
'order' => 'DESC' | |
); | |
$loop = new WP_Query($args); | |
while ($loop->have_posts()) : $loop->the_post(); | |
global $product; ?> | |
<div class="span3"> | |
<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> | |
<?php if (has_post_thumbnail($loop->post->ID)) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); | |
else echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="My Image Placeholder" width="65px" height="115px" />'; ?> | |
<h3><?php the_title(); ?></h3> | |
<span class="price"><?php echo $product->get_sale_price(); ?></span> | |
<span class="price"><?php echo $product->get_regular_price(); ?></span> | |
</a> | |
<?php woocommerce_template_loop_add_to_cart($loop->post, $product); ?> | |
</div><!-- /span3 --> | |
<?php endwhile; ?> | |
<?php wp_reset_query(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment