Tagged: ,

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #584335

    Hi there,

    i have a masonry with categories “one” , “two”, “three”. Is it possible to have a link in order to display directly to the masonry with the specific category sorted?

    I dont want to create 3 different masonries in order to choose each time to display each category. I just want in the same masonry to have by default sorting links.

    Thank you instead,

    #585128

    Hi georgesociel,

    Could you provide us with a link to the site in question so that we can take a closer look please?

    Best regards,
    Rikard

    #585234

    below are my credentials.

    Check out the page

    i want to have a link that by default open that page with “gossip” articles.Something like http://philadelphia360.gr/blog?cat=gossip

    #586613

    Hi!

    Please try the solution provided here: https://kriesi.at/support/topic/linking-to-filtered-portfolio-ajax/#post-430830

    Regards,
    Ismael

    #1186700
    This reply has been marked as private.
    #1187176

    Hi,

    You have to use the category slug instead of its ID, so if the category name is “math” for example, the URL should look something the following.

    https://siteeu/tit-6?psort=math
    

    You can use this snippet in the functions.php file instead of the previous one.

    add_action('wp_footer', 'ava_auto_click');
    function ava_auto_click() {
    	if(!$_GET["psort"]) return;	
    ?>
    		<script>
            (function($){	
                $(window).load(function() {
    <?php echo '$(".'. $_GET["psort"] .'_sort_button").trigger("click");'; ?>
                });	
            })(jQuery);
            </script>
    <?php
    }
    

    Best regards,
    Ismael

    #1187257

    Thaks!

    Now I understand!

    #1187531

    Hi bcerin,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic.

    Best regards,
    Rikard

    #1301166

    The Answer above – I don´t get it. But after a bit of testing I hve y solution for y 3 categories – Alltag, Artbeit, Kultur

    /* 
    masonry sort to make it a link
    ************************************************************************  ENFOLD  */
    function ava_auto_click() {
    	if ( $_GET["psort"] == "kultur" ) { 
    ?>
    		<script> 
                jQuery(window).on('load', function () {
                    jQuery('.teilhabe-an-kultur_sort_button').trigger('mouseover');
                });	 
            </script>
    <?php
    	} elseif ( $_GET["psort"] == "arbeit" ) {
    ?>
    		<script>
             jQuery(window).on('load', function () {
                    jQuery('.teilhabe-an-arbeit_sort_button').trigger('mouseover');
                });	 
            </script>
    <?php
    	} elseif ( $_GET["psort"] == "alltag" ) {
    ?>
    		<script> 
                jQuery(window).on('load', function () {
                    jQuery('.teilhabe-an-alltag_sort_button').trigger('mouseover');
                });	 
            </script>
    <?php
    	}
        
    } // ava auto click
    add_action('wp_footer', 'ava_auto_click');
    /**/
    
    • This reply was modified 3 years, 7 months ago by Raphael.
    #1301293

    Hi,

    @Raphael You do not have to repeat the the script for every category because the $_GET[“psort”] should already contain the category name or slug.

    For example, to trigger the button for the teilhabe-an-kultur category, all you need to do is assign the category slug as the value of the psort variable.

    https://siteeu/tit-6?psort=teilhabe-an-kultur
    

    The script will automatically extract that value and trigger the teilhabe-an-arbeit_sort_button button..

    <?php echo '$(".'. $_GET["psort"] .'_sort_button").trigger("click");'; ?>
    

    .. because $_GET[“psort”] contains “teilhabe-an-kultur’.

    Best regards,
    Ismael

    #1303391

    Hi Ismael,

    this doesn’t work here. If I call the link with var psort=entwicklung the filter item is not active. Only if I reload the page it becomes selected.

    Is there a way to fix this?

    #1303468

    Hi. I know this has been covered, but I cannot make it work.

    How do I link directly to portfolio displaying only entries from selected category?

    I know there is a link for categories from the menu, but it displays a page that is acting differently than my regular portfolio page (the thumbnails linked to a page rather than expanding the image or video).

    I would like to either get an option to link to category as noted above (?psort=manufacturing), or edit the page based on the link from the “Portfolio Categories” page.

    Is that possible?

    Thank you

    #1303692

    Hi,

    . If I call the link with var psort=entwicklung the filter item is not active.

    @Onlineplaner: Are you trying to access the link from the same page where the sorting button are? Please note that the script above will only work on page load, not on menu click. You may need to add a click event listener to the menu items manually. Please feel to open a new thread if you need further assistance.


    @purmar
    : You might be trying to do a different thing. This thread is about the sorting button, not about redirecting to category pages. Please open a new thread and post the details in the private field.

    We will close this thread for now.

    Best regards,
    Ismael

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘direct link to masonry category’ is closed to new replies.