Created
June 26, 2019 06:07
-
-
Save rajucs/9b55122120a6d7646210030dd5a3627e 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
| <section> | |
| <h3>latest product section start</h3> | |
| <?php | |
| $args = array( | |
| 'number' => $number, | |
| 'orderby' => 'title', | |
| 'order' => 'ASC', | |
| 'hide_empty' => $hide_empty, | |
| 'include' => $ids | |
| ); | |
| $product_tags = get_terms( 'product_tag', $args ); | |
| $count = count($product_tags); | |
| if ( $count > 0 ){ | |
| foreach ( $product_tags as $product_tag ) { | |
| // echo '<h4><a href="' . get_term_link( $product_tag ) . '">' . $product_tag->name . '</a></h4>'; | |
| $args = array( | |
| 'posts_per_page' => -1, | |
| 'tax_query' => array( | |
| 'relation' => 'AND', | |
| array( | |
| 'taxonomy' => 'product_tag', | |
| 'field' => 'slug', | |
| // 'terms' => 'white-wines' | |
| 'terms' => $product_tag->slug, | |
| 'product_tag'=> "latest-product" | |
| ) | |
| ), | |
| 'post_type' => 'product', | |
| 'orderby' => 'title,' | |
| ); | |
| $products = new WP_Query( $args ); | |
| echo "<ul>"; | |
| while ( $products->have_posts() ) { | |
| $products->the_post(); | |
| ?> | |
| <li> | |
| <a href="<?php the_permalink(); ?>"> | |
| <?php the_title(); ?> | |
| <?php echo get_the_post_thumbnail( $post_id, 'thumbnail' ); ?> | |
| </a> | |
| </li> | |
| <?php | |
| } | |
| echo "</ul>"; | |
| } | |
| } | |
| ?> | |
| </section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment