<?php wp_dropdown_categories(); ?>
→ This is how we can populate the categories in a drop-down.
N.B. We are dealing with WordPress.
This is how we generate a query in Wordpress:
<?php
// the query
$the_query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 10,
'post_status' => 'publish',
'category_name' => 'staff'
) );
?>
I need some help in php here →
'category_name' => 'staff'
staff is a category, for example, here. How can we write in terms of PHP or Ajax so that whatever category is chosen from the populated category from the drop-down should come above dynamically based on the selection from the drop-down?
Means → 'staff'
This should come up dynamically from the drop down. I am normal in PHP and ajax If someone can guide me than help will be highly appreciated.