Tagged: enfold, portfolio grid
-
AuthorPosts
-
June 14, 2016 at 8:36 am #647845
Hi
Again, congrat’s on an awesome theme. Enfold has been absolutely fantastic!
I’m struggling to find documentation on this, so please forgive me: I’d like to setup a URL that pre-filters a portfolio grid by category.
IE:
I might have 4 categories on a particular page (eg http://www.example.com/work), that contains a portfolio grid:
* Websites
* Graphic Design
* UI Design
* SoftwareWhen I visit this page, the sort / filter options would be shown thus:
All / Websites / Graphic Design / UI Design / Software…with all items in the portfolio grid showing, and the “All” filter option selected.
MY QUESTION is; Is there (or could there be) a way to pre-filter the list using a URL flag – so if I was to visit (eg) http://www.example.com/work#graphic-design, the [Graphic Design] option is selected by default?
Thanks
Dan
June 14, 2016 at 1:36 pm #647971Hey psdtofinal,
Please try adding this at the very end of your themes / child themes functions.php file:
Change the digit 1 in eq(1) to 2, 3 and so on to activate the filter of your choice.
Add the correct page id by right click and inspect the body tag in the < body > class of the page to target specific pages.
function select_portfolio_filter(){ ?> <script> jQuery( window ).load(function() { jQuery('.page-is-xx .inner_sort_button:eq(1)').click(); jQuery('.page-id-xx .inner_sort_button:eq(1)').click(); }); </script> <?php } add_action('wp_head', 'select_portfolio_filter');
Best regards,
VinayMarch 8, 2017 at 1:46 am #757431Hi Vinay,
I’m having same problem.
I have two portfolio pages on a clients’ website. I put this code into my functions.php file.
function select_portfolio_filter(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘.page-id-48 .inner_sort_button:eq(2)’).click();
jQuery(‘.page-id-828 .inner_sort_button:eq(2)’).click();
});
</script>
<?php
}
add_action(‘wp_head’, ‘select_portfolio_filter’);It’s working on page-id-48; but, it’s not working on page-id-828. Is there a reason it would work on one; but, not on another?
Thanks,
WendyMarch 8, 2017 at 2:03 am #757438Hi Vinay,
I figured it out. For some reason, the second filter was number 4. :)
Thanks.
WendyMarch 9, 2017 at 7:25 am #758182 -
AuthorPosts
- You must be logged in to reply to this topic.