Skip to content

Instantly share code, notes, and snippets.

@herbie4
Created September 22, 2022 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herbie4/07d66893e6463c3cdc9a410fb004c838 to your computer and use it in GitHub Desktop.
Save herbie4/07d66893e6463c3cdc9a410fb004c838 to your computer and use it in GitHub Desktop.
Enfold theme: using a url param to show the selected portfolio grid category. Use ?psort=[categoryname] to trigger.
/* Enfold theme: using a url param to show the selected portfolio grid category */
jQuery(window).on('load', function ($) {
jQuery.QueryString = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=');
if (p.length != 2) continue;
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
return b;
})(window.location.search.substr(1).split('&'));
var param = jQuery.QueryString["psort"];
jQuery("."+param+"_sort_button").trigger("click");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment