function mtm_taxonomy_query_sub($archivetype, $display = 3, $order = 'DESC', $orderby = 'date') { $taxonomy = mtm_acf_taxonomy_sub_property($archivetype, 'taxonomy'); $terms = mtm_acf_taxonomy_sub_property($archivetype, 'name'); if (get_sub_field('mtm_' . $archivetype . '_archive_taxonomy_number')) { $display = get_sub_field('mtm_' . $archivetype . '_archive_taxonomy_number'); } return mtm_page_component_taxonomy_query($taxonomy, $terms, $display, $orderby, $order); }
function mtm_ajax_filter_get_posts($taxonomy) { // Verify nonce if (!isset($_GET['mtm_nonce']) || !wp_verify_nonce($_GET['mtm_nonce'], 'mtm_nonce')) { die('Nonce is not verified'); } // get taxonomy and term data from term id $taxonomy = $_GET['taxonomy']; $term_obj = get_term($taxonomy); $term_slug = $term_obj->slug; $term_tax = $term_obj->taxonomy; // run query from function $ajax_query = mtm_page_component_taxonomy_query($term_tax, $term_slug, 12, 'menu_order'); if ($ajax_query->have_posts()) { while ($ajax_query->have_posts()) { $ajax_query->the_post(); // template part mtm_get_template_part('mtm-content', 'grid-view'); } wp_reset_postdata(); } die; }