Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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
    * Software

    When 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

    #647971

    Hey 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,
    Vinay

    #757431

    Hi 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,
    Wendy

    #757438

    Hi Vinay,

    I figured it out. For some reason, the second filter was number 4. :)

    Thanks.
    Wendy

    #758182

    Hi Wendy,

    Great, glad you got it working and thanks for the feedback. Please let us know if you should need any further help on the topic.

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.