pharmadave
Forum Replies Created
-
This is great. Helped me out a lot.
I’ve added support for “reselecting the chosen item in the dropdown” by adding some code to set the “selected” attribute too….
Modified get_terms_dropdown function below.
Set
'$search_values['cat'] = 'your chosen items slug'
before calling the function.
function get_terms_dropdown($taxonomies, $args) { global $search_values; $myterms = get_terms($taxonomies, $args); $output = ""; foreach ($myterms as $term) { $root_url = get_bloginfo('url'); $term_taxonomy = $term->taxonomy; $term_slug = $term->slug; $term_name = $term->name; $value = $term->term_id; if ($search_values['cat'] == $term->slug) { $selected = 'selected="selected" '; } else { $selected = ''; } $output .= "<option value='" . $value . "' " . $selected . ">" . $term_name . "</option>"; } return $output; }
OK. It turns out that the “bookings” filter only works if you want to filter out the events WITHOUT bookings. ie you can either have all events (bookings=0) or you can have events which allow bookings (bookings=1).
How do I get “events which don’t allow bookings” ?
I haven’t really done much with shortcodes at all in WordPress. I was hoping for some sample PHP code to manipulate “the loop”. I think I’ve managed to work it out, using a combination of EM_Events:: and EM_Event.
It would be really nice if any of the tutorials touched on how to treat Events “like Posts”, and the properties/functions available for Events and what they’re called.
I’m lucky in that I have PHPStorm. I was able to trace the functions and use the structure-viewer to find the applicable properties and functions I needed. Couldn’t find any in examples though.I’m a fairly new PHP / WordPress developer and at the moment I don’t see an easy way of integrating PHP code and shortcode functionality…..Is there?