Im currently using owl-carrousel with a category of the latest product added and i need to create other carrousel for a front page using the categories of marvel comics and dc comics
<code><div class="carousel-news">
<div class="owl-carousel">
<?php
$args = array(
"post_type" => "product",
"posts_per_page" => 10,
'orderby' => 'date',
'order' => 'DESC',
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="product-thumb">
<a href="<?php echo get_permalink( $loop->post->ID ); ?>" class="btn-overall"></a>
<figure>
<?php
if ( has_post_thumbnail( $loop->post->ID ) )
echo get_the_post_thumbnail( $loop->post->ID, 'full' );
else
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder"/>';
?>
</figure>
<h2><?php the_title(); ?></h2>
<?php
echo $product->get_price_html();
?>
</div>
<?php
endwhile;
}
?>
</div>
</code>
<code><div class="carousel-news">
<div class="owl-carousel">
<?php
$args = array(
"post_type" => "product",
"posts_per_page" => 10,
'orderby' => 'date',
'order' => 'DESC',
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="product-thumb">
<a href="<?php echo get_permalink( $loop->post->ID ); ?>" class="btn-overall"></a>
<figure>
<?php
if ( has_post_thumbnail( $loop->post->ID ) )
echo get_the_post_thumbnail( $loop->post->ID, 'full' );
else
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder"/>';
?>
</figure>
<h2><?php the_title(); ?></h2>
<?php
echo $product->get_price_html();
?>
</div>
<?php
endwhile;
}
?>
</div>
</code>
<div class="carousel-news">
<div class="owl-carousel">
<?php
$args = array(
"post_type" => "product",
"posts_per_page" => 10,
'orderby' => 'date',
'order' => 'DESC',
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="product-thumb">
<a href="<?php echo get_permalink( $loop->post->ID ); ?>" class="btn-overall"></a>
<figure>
<?php
if ( has_post_thumbnail( $loop->post->ID ) )
echo get_the_post_thumbnail( $loop->post->ID, 'full' );
else
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder"/>';
?>
</figure>
<h2><?php the_title(); ?></h2>
<?php
echo $product->get_price_html();
?>
</div>
<?php
endwhile;
}
?>
</div>
im currently using this code and i have tried using arrays to uses terms and slugs but i dont have results
New contributor
nicolas rojas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.