I have the following
- custom post type:
lesson
- custom Taxonomy:
subject
- which contains terms like
math
,reading
, etc.)
- which contains terms like
I have configured my page so that the user may filter the results by entering a taxonomy "subject" as a query variable:
http://www.myWebsiteURL.com/lessons&lc=study-skills
This works great for getting a single taxonomy category, however I am having difficulty getting ALL taxonomy categories in a single request (ie for an overview/unfiltered page).
Here is how I'm building my query:
<?php
/* if URL query value is a valid category, get all lessons for that category.
If it is not a valid category (or not category is provided), get ALL lessons. */
$args = ["post-type"=>"lesson", "post-status" => "publish"];
$validCats = ['study-skills','time-management','math','tutoring','reading','online-learning'];
if ( isset($_GET['lc']) && in_array($_GET['lc'], $validCats) ) {
$args["subject"] = $_GET['lc'];
} else {
$arg["subject"] = "*"; // ??? what goes here?
}
$lessons = new WP_Query($args);
?>
lc[]=study-kills&lc[]=math-is-great
? That would be equal to form fields with a name ofname="lc[]"
./lessons
to get all the taxonomy terms. Thats what I need help figuring out