Created
November 19, 2017 00:14
-
-
Save jamiemitchell/bbcd5483fa86d57c2ca6038caa494376 to your computer and use it in GitHub Desktop.
wp_loop_query
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 | |
| $term = get_queried_object(); //Получаю текущий обьект запроса | |
| // Узнаю текущий id рубрики | |
| $term_id = $term->term_id; | |
| ?> | |
| <?php | |
| $args = array( | |
| 'post_type' => 'product', | |
| 'product_category' => $term->slug, | |
| 'posts_per_page' => 10, | |
| 'post_status' => 'publish', | |
| 'orderby' => 'id', | |
| 'order' => 'ASC' | |
| ); | |
| $var_name = new WP_Query($args); | |
| while ( $var_name->have_posts() ) : $var_name->the_post(); | |
| get_template_part('loop-product'); | |
| endwhile; | |
| wp_reset_postdata(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment