Linking to filter on Post Grid

Q&ACategory: PluginLinking to filter on Post Grid
iwantthem asked 2 years ago

Hi there,
Is it possible to link to a specific filter on Post Grid?
I notice the URL doesn’t change when clicking a filter in page. Can I add a parameter to the URL to do this?
OR is it possible to use something like jQuery to activate the filter if it knew where you came from? e.g. clicking a specific DIV with a class like .filter1.
I hope this makes sense.
Many thanks

4 Answers
Best Answer
iwantthem answered 2 years ago

I managed to get this working. I enqueued a small JS script only on my Post Grid page (code below).


//Get URL and strip it down
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(;
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));

//Get the filter varible
var filter = getParameterByName('filter');

//If there is something in filter action the click and add active class
setTimeout(function() {
$('div[data-filter=".'+filter+'"]').trigger('click').addClass( "active" );


Going to loads the post grid page and once loaded ‘clicks’ the climbing filter.
Just thought I’d post it here in case anyone else wanted to do it.

Hasan Staff answered 2 years ago

Welcome to our forum,
Probably answer is No, Post Grid is generated by shortcode all parameter come from post meta,
Can you please give me a live example what you like to do ?

iwantthem answered 2 years ago

Thanks for your reply.

Here’s a site that does what I mean. I know it’s not running wordpress, but you can see that when you click a filter, it adds a parameter to the URL allowing you to link directly to that page with the filter active.


Grid with climbing adventure selected:
I was wondering if it would be possible to use jQuery (or something) to trigger the click event on the appropriate filter when the page loads. That is, if I’ve come from a specific HTML element (or class name) on another page.

e.g. Lets say I have 4 images on my homepage that show the names of my filters on them (climbing, trekking, biking, rafting). A Post Grid with filters is on another page. When I click on the ‘Climbing’ image on the homepage, I’d like to go to the Post Grid page with the ‘Climbing’ filter selected.

I hope that helps.

Thanks again for your time.


Hasan Staff replied 2 years ago

Thanks for your explain & demo link, this is advance filtering , its seems our plugin can’t play this role, although we have filterable(Basic) grid by terms/categories,here is the demo

iwantthem answered 2 years ago

No problem.
I am currently using your Post Grid plugin and have the filters working. I just wanted to load the page with a filter active.
Ok, so there is no way to load your link with “Albums” active?
Hmmmm, I’m wondering if there is a way to hack it some how…