View difference between Paste ID: jg2hr5yz and sQskQuur
SHOW: | | - or go back to the newest paste.
1
            <?php 
2
            $categories = get_categories(
3
                array(
4
                   'taxonomy'      => TribeEvents::TAXONOMY,
5
                   'selected'      => 0,
6
                   'orderby'       => 'name'
7
                ) );
8
            ?>
9
10
            <script type="text/javascript"><!--
11
            function onCatChange(select) {
12
                var slug = select.options[select.selectedIndex].value;
13
                var link = '<?= tribe_get_events_link() ?>';
14-
                location.href = (slug == 'all') ? link :
14+
                location.href = (slug == 'all') ? link : link + 'category/' + slug;
15-
                    link + 'category/' + select.options[select.selectedIndex].value;
15+
16
            --></script>
17
18
            <select id="categories" onchange="onCatChange(this)" >
19
                <option value="all">All Events</option>
20
                <?php
21
                foreach ($categories as $cat) {
22
                    if (tribe_meta_event_category_name() == $cat->name) $selected='selected';
23
                    else $selected = '';
24
                ?>
25
                <option value="<?= $cat->slug ?>" <?= $selected ?>><?= $cat->name ?></option>
26
                <?php } ?>
27
            </select>