Load Taxonomy Terms
-
Hi there,
I was wondering if it is possible to use Ajax Load More to retrieve a list of Taxonomy Terms rather than the posts within those Terms..
Eg: Work Categories
List would be: Chairs, Tables, Lamps etc etcI’ve tried something like this: but not having any luck.
<?php $taxonomy = 'work-category'; $taxonomy_terms = get_terms( $taxonomy, array( 'hide_empty' => 0, 'fields' => 'ids' ) ); // Use the new tax_query WP_Query argument (as of 3.1) $taxonomy_query = new WP_Query( array( 'tax_query' => array( array( 'taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $taxonomy_terms, ), ), ) ); // Pass $post_ids array to Ajax Load More post__in parameter echo do_shortcode('[ajax_load_more post__in="'. implode(',', $taxonomy_terms) .'" orderby="post__in" preloaded="true" preloaded_amount="6" posts_per_page="6" button_label="View More Works" repeater="template_3" button_loading_label="Loading Work..." scroll="true" transition="none" transition_container_classes="inViewport"]'); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Load Taxonomy Terms’ is closed to new replies.