Wordpress – Link to a date-filter element isn't added to the base url and apply filter

Viewed 113

Page of WordPress site use an on page filter menu which user can click on items to filter posts type below. I have already added in each anchor tag href value.

<ul class="list-inline filter">
        <li class="active">
       <a href="#.*" data-filter="*">All solutions</a>
      </li>
      <li class="cat-item cat-item-1">
       <a href="#.Metallurgy" data-filter=".Metallurgy">Metallurgy</a> 
      </li>
      <li class="cat-item cat-item-2"> 
       <a href="#.Food" data-filter=".Food">Food industry</a>
      </li>
    </ul>

And here is js code to simulate a click on the appropriate element based on a URL Fragment.

jQuery(document).ready(function($){
    var currentFilter = window.location.hash.substr(1);

    $('.js-filter [data-filter="'+ currentFilter +'"]').trigger('click');
});

The deal is when I click on anchor tag it isn't add a href value after base url. For example, I want to have an url "example.com/solutions#.Metallurgy". Click applies filter on data, but url stays as "example.com/solutions".

Moreover, when I change url directly to "example.com/solutions#.Metallurgy" Wordpress redirects me to "example.com/solutions/#.Metallurgy". It brings me to the same page with no filter applied.

0 Answers
Related