Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $categories = get_categories(
- array(
- 'taxonomy' => TribeEvents::TAXONOMY,
- 'selected' => 0,
- 'orderby' => 'name'
- ) );
- ?>
- <script type="text/javascript"><!--
- function onCatChange(select) {
- var slug = select.options[select.selectedIndex].value;
- var link = '<?= tribe_get_events_link() ?>';
- location.href = (slug == 'all') ? link : link + 'category/' + slug;
- }
- --></script>
- <select id="categories" onchange="onCatChange(this)" >
- <option value="all">All Events</option>
- <?php
- foreach ($categories as $cat) {
- if (tribe_meta_event_category_name() == $cat->name) $selected='selected';
- else $selected = '';
- ?>
- <option value="<?= $cat->slug ?>" <?= $selected ?>><?= $cat->name ?></option>
- <?php } ?>
- </select>
Advertisement
Add Comment
Please, Sign In to add comment