Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <section class="products-list">
- <?php
- $current_page = get_queried_object();
- $category = $current_page->post_name;
- $args = array( 'post_type' => 'product_elm', 'category_name' => $category, 'posts_per_page' => 2);
- $the_query = new WP_Query( $args );
- if ( $the_query->have_posts() ) {
- while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
- <div class="item">
- <a href="<?php the_permalink() ?>">
- <div class="img">
- <?php the_post_thumbnail(); ?>
- </div>
- <h2> <?php the_title(); ?></h2>
- </a>
- </div>
- <?php
- endwhile;
- }
- next_posts_link( 'Older Entries', $the_query->max_num_pages );
- previous_posts_link( 'Newer Entries' );
- wp_reset_postdata();
- ?>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement