-
AuthorPosts
-
May 24, 2016 at 10:01 pm #637754
Hi, I have a followup question on a closed ticket (#624419) and was hoping you could help. My client wants to have a link that sorts by TWO categories… the code you supplied works perfectly for one category, which is copied below. The specific link example you provided was http://mysite.com/linktopage/?msort=engineering
Is there a way to sort by department and a location keyword? Like, engineering AND india? Thanks so much!
Add this in the functions.php file:
// auto trigger
add_action(‘wp_footer’, ‘ava_custom_script’);
function ava_custom_script() {
?>
<script>
(function($){
function getQueryParams(qs) {
qs = qs.split(“+”).join(” “);
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
}return params;
}var $_GET = getQueryParams(document.location.search);
$(window).load(function() {
switch($_GET[‘msort’]) {
case ‘engineering’:
$(‘.engineering_sort_button’).trigger(‘click’);
break;
case ‘marketing’:
$(‘.marketing_sort_button’).trigger(‘click’);
break;
case ‘operations’:
$(‘.operations_sort_button’).trigger(‘click’);
break;
case ‘sales’:
$(‘.sales_sort_button’).trigger(‘click’);
break;
}
});
})(jQuery);
</script>
<?php
}
The icon link should look like this:May 26, 2016 at 12:46 pm #638673Hello!
I don’t think that would be possible with the current Enfold Portfolio sorting implementation, there may be a way to do it but that would considered a custom work. You can request a customisation quote from a third-party provider here.
Regards,
JosueMay 26, 2016 at 3:06 pm #638742Thanks, here’s how I solved it, in case somebody else is doing the same thing… just created new category parents for the locations, then put the children categories in there. That way, my client could easily choose which specific locaton / dept they want, and we reused the same names for the departments. Worked perfectly.
-
AuthorPosts
- The topic ‘Followup question about sorting by category’ is closed to new replies.