-
AuthorPosts
-
February 16, 2016 at 7:10 pm #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,
February 18, 2016 at 4:35 am #585128Hi georgesociel,
Could you provide us with a link to the site in question so that we can take a closer look please?
Best regards,
RikardFebruary 18, 2016 at 8:42 am #585234below 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
February 21, 2016 at 8:40 am #586613Hi!
Please try the solution provided here: https://kriesi.at/support/topic/linking-to-filtered-portfolio-ajax/#post-430830
Regards,
IsmaelFebruary 21, 2020 at 1:12 pm #1186700This reply has been marked as private.February 24, 2020 at 4:08 am #1187176Hi,
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,
IsmaelFebruary 24, 2020 at 11:25 am #1187257Thaks!
Now I understand!
February 25, 2020 at 4:27 am #1187531Hi 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,
RikardMay 19, 2021 at 11:03 am #1301166The 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, 6 months ago by Raphael.
May 20, 2021 at 4:25 am #1301293Hi,
@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,
IsmaelJune 1, 2021 at 11:41 am #1303391Hi 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?
June 1, 2021 at 9:34 pm #1303468Hi. 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
June 3, 2021 at 5:28 am #1303692Hi,
. 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 -
AuthorPosts
- The topic ‘direct link to masonry category’ is closed to new replies.