Link a post grid category

Hi there, I’m trying to link a custom post grid (wpbakery page builder) specific category.

Scenario: I have a page with a custom post grid and a filter for categories. I would like to link this page with post grid filtered by one of these categories.

I have seen that the filter uses the html attribute data-vc-grid-filter-value=".vc_grid-term-8" to filter the category. In other word the page builder attributes a custom class to every category.

The page with the link is this: https://www.zadrainterni.it/in-costruzione/

This is the page that contain the custom post grid with category filter: https://www.zadrainterni.it/design-progetti/

I have tried to use the data-vc-grid-filter-value attribute applied to link, but it doesn’t work. Have you have any suggestion to achieve this result?

Every help will be very appreciated. Thank you very much

Hi Alessandro,

Please add the following Javascript code under Theme Options > JS:

jQuery(document).ready(function($) {
    var hash = window.location.hash.substr(1);
    if(hash){
         jQuery('[data-vc-grid-filter-value=".'+hash+'"]').trigger('click');
    }
});

Then the links should be:

Hope that helps and thank you for understanding.

1 Like

It works like a charme. Just what I’ve need.

Thank you so much mate. High five

You’re welcome, Alessandro.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.