Last active
March 27, 2017 19:32
-
-
Save fatihtoprak/1ec06222cc883d04d61176e7773e7214 to your computer and use it in GitHub Desktop.
Taxonomy loop.
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 | |
| $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; | |
| $q = new WP_Query([ | |
| 'post_type' => 'directory', // replace with yours post type. | |
| 'posts_per_page' => get_option('posts_per_page'), | |
| get_query_var( 'taxonomy' ) => get_query_var( 'term' ), | |
| 'paged' => $paged | |
| ]); | |
| $temp_query = $wp_query; | |
| $wp_query = null; | |
| $wp_query = $q; | |
| if ( $q->have_posts() ) : | |
| while ( $q->have_posts() ) : $q->the_post(); | |
| get_template_part(ARESCHILDPATH.'/loop','directory' ); | |
| endwhile; | |
| endif; | |
| wp_reset_postdata(); | |
| echo getAresPagination(); // replace with yours pagination. | |
| $wp_query = NULL; | |
| $wp_query = $temp_query; | |
| ?> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Working pagination with custom taxonomy archive page.
taxonomy-{tax-name}.phpCreate yours file, into yours theme root folder. And call, yours taxonomy archive page from browser.
http://foo.tld/tax-slug