Use output of wp_dropdown_categories($args)

Please be gentle, I’m new to all this coding!
I have finally worked out how to get a frontend dropdown field allowing me to select from EDD categories (I got this from the Codex):

<div class=”gallery-row”>
<li id=”categories”>
<h2><?php _e( ‘Categories:’ ); ?></h2>
<form id=”category-select” class=”category-select” action=”<?php echo esc_url( home_url( ‘/’ ) ); ?>” method=”get”>

<?php $args = array(‘taxonomy’ => ‘download_category’, // EDD custom post type Taxonomy
‘order’ => ‘ASC’ // Order of the list
wp_dropdown_categories($args); ?>
<input type=”submit” name=”submit” value=”view” />

This is my original code,’selecttaxonomy’ is a ACF taxonomy field (and only appears on the backend):

<div class=”content clearfix”><div class=”gallery-row2″>
$current_page = get_query_var(‘paged’); // Retrieving the data
$per_page = get_option(‘posts_per_page’);
$offset = $current_page > 0 ? $per_page * ($current_page -1) : 0;
$taxval = get_field(‘selecttaxonmy’);

$product_args = array(
‘post_type’ => ‘download’,
‘posts_per_page’ => $per_page,
‘offset’ => $offset,
‘download_category’ => $taxval,
$products = new WP_Query($product_args);

<?php if ($products->have_posts()) : $i = 1; ?> //and off into the loop…..

What I can’t figure out is how to replace ‘selecttaxonomy’ with the output of the dropdown – help please.
The page I’m working on is: (ignore the styling please)

Read more here:: Use output of wp_dropdown_categories($args)

Leave a Reply

Your email address will not be published. Required fields are marked *