How to add links url to Mixitup filtering menu WordPress

I’m trying to add links/urls to the Mixitup plugin filtering menu so that I can link to the specific filtering link from another page. How do I do that? Based on that tutorial I found (filtering via url), this code was supposed to work

$( document ).ready(function() {
    var filterOnLoad = window.location.hash ? '.'+(window.location.hash).replace('#','') : 'all';
     $('#events-list').mixItUp({
         controls: {
            enable: true,
        },
        load: {
            filter: filterOnLoad,
        },
        animation: {
            // enable: false,
            // duration: 200,
            effects: 'fade',
        },
        layout: {
            display: 'inline-block',
        },
    });
});

But my filtering menu didn’t work. Here’s my filtering menu in wordpress

Read More
<div class="filtermenu">
<ul id="filters">
    <li class="filter" data-filter="all" class="selected">All</li>
    <?php 
        $terms = get_terms('category', 'include=6,7&hide_empty=0'); // get all categories, but you can use any taxonomy
        $count = count($terms); //How many are they?
        if ( $count > 0 ){  //If there are more than 0 terms
            foreach ( $terms as $term ) {  //for each term:
                echo "<li class=".filter." data-filter='.".$term->slug."'>" . $term->name . "</li>n";
                //create a list item with the current term slug for sorting, and name for label
            }
        } 
    ?>
</ul>
</div>

I tried to change the <li> to <a> and adding href=”#” but since it was in <?php> tag, it didn’t work and I don’t know why….

Related posts