WordPress.org

Ready to get started?Download WordPress

Forums

Calling get_categories more than once? (1 post)

  1. annamariie
    Member
    Posted 1 year ago #

    Hey!

    This is probably an incredibly easy answer and I've just been staring at this code for too long and can't figure it out - but any help would be GREATLY appreciated!

    Right now what I'm trying to do is call get_categories twice to display a dropdown for all categories (excluding a few) and then one to display the children of one category.

    URL I'm using: http://metrowellness.buzzfishmarketing.com/classes-events/

    Code:

    <?php
                $categories = get_categories (
                    array(
                       'taxonomy'      => TribeEvents::TAXONOMY,
                       'selected'      => 0,
                       'exclude'      => 42,
                       '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>

    Both sets of code for the dropdowns are similar (just changes in the exclude, etc).

    [ Please do not bump, that's not permitted here. ]

Topic Closed

This topic has been closed to new replies.

About this Topic