Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72388

Wordpress - Retrieve all Posts by 'post_type' then filter by taxonomy

$
0
0


I have a Wordpress installation with ACF (Advanced Custom Fields) installed. I created the Class post type and each Class has it's on Location value.
How can I retrieve every Class and get the location I have chosen for that Class? I'm currently using this function to retrieve the name of the 'Programs':

<pre>
    $args = array(
        'post_type' => 'class',
        'posts_per_page' => -1,
    );
    $query = new WP_Query($args);
    if ($query->have_posts() ) : 
        while ( $query->have_posts() ) : $query->the_post();
            echo get_the_ID();
            echo get_the_title();
        endwhile;
    endif;
</pre>

I'm trying to populate a dropdown list 'Location' which filters the next dropdown with the classes available for that location.
Any help or advice would be greatly appreciated. Thanks


Viewing all articles
Browse latest Browse all 72388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>