Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1113854

    Hey folks!

    I have a masonry element on a page which is showing portfolio items, and those portfolio items have multiple sortable categories. That’s fine and works great on the page. What I’d like to do however is to figure out of there’s any way that I can link to this page, and have the portfolio items pre-sorted according to whichever category I’d like. So, say, I could have a link on another page saying “Photography”, which when clicked it loads the page with the masonry element, but with the Photography category pre-selected.

    Is this possible? Would love if so. :)

    #1114214

    Hey chiliharstad,

    Please have a look at the solution posted here
    https://kriesi.at/support/topic/linking-to-filtered-portfolio-ajax/#post-430830

    Best regards,
    Victoria

    #1114268

    Hi Victoria, thanks for the reply. Couldn’t find a thread like that when I searched, but just tried to implement the same and when the page that’s linked to loads, the filtering still isn’t in effect.

    Portfolio categories visible on the page are Publikasjoner, Studentoppgaver, with slugs the same but lowercase, and two other categories.

    /* 
     * Add functions to allow prefiltering portfolio items from a link 
     * https://kriesi.at/support/topic/linking-to-filtered-portfolio-ajax/#post-430830
     * */
    add_action('wp_footer', 'ava_auto_click');
    function ava_auto_click() {
    	if ( $_GET["psort"] == "publikasjoner" ) { 
    ?>
    		<script>
            (function($){	
                $(window).load(function() {
                    $('.publikasjoner_sort_button').trigger('click');
                });	
            })(jQuery);
            </script>
    <?php
    	} elseif ( $_GET["psort"] == "studentoppgaver" ) {
    ?>
    		<script>
            (function($){	
                $(window).load(function() {
                    $('.studentoppgaver_sort_button').trigger('click');
                });	
            })(jQuery);
            </script>
    <?php
    	}
    }
    #1114436

    Hi chiliharstad,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

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