如何添加链接url到Mixitup过滤菜单Wordpress

时间:2016-02-23 04:34:26

标签: javascript php jquery wordpress mixitup

我正在尝试将链接/网址添加到Mixitup插件过滤菜单中,以便我可以链接到其他网页的特定过滤链接。我怎么做?根据我发现的那个教程(filtering via url),这段代码应该可以正常工作

$( 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',
        },
    });
});

但我的过滤菜单没有用。这是我在wordpress中的过滤菜单

<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>

我尝试将<li>更改为<a>并添加href =&#34;#&#34;但由于它是<?php>标签,它没有用,我也不知道为什么......

0 个答案:

没有答案