-
AuthorPosts
-
April 16, 2015 at 3:11 pm #429639
Is it possible to link from a button on one page, to a specific filered category on an Ajax portfolio gallery.
For example: Linking form a page, which opens this page http://kriesi.at/themes/enfold/portfolio/portfolio-ajax/ but shows html instead of all?
Many Thanks
Regards
ColinApril 17, 2015 at 10:57 am #430225Hey waveseven!
Thank you for using Enfold.
Create a button and add the url with the “psort” parameter using the portfolio category slug as the value.
http://www.mysite.com/myportfolio?psort=html
And then add this script in the functions.php file to trigger the sort button.
add_action('wp_footer', 'ava_auto_click'); function ava_auto_click() { if ( $_GET["psort"] == "html" ) { ?> <script> (function($){ $(window).load(function() { $('.html_sort_button').trigger('click'); }); })(jQuery); </script> <?php } }
Cheers!
IsmaelApril 17, 2015 at 11:32 am #430241Hi Ismael
Thanks for your reply. Does this mean I could do it for each category?
For example:
Can I link from one page to the filered category html and link from another page to the filtered category photography etcMany Thanks
Regards
ColinApril 19, 2015 at 8:05 am #430830Hey!
Something like this should work.
add_action('wp_footer', 'ava_auto_click'); function ava_auto_click() { if ( $_GET["psort"] == "html" ) { ?> <script> (function($){ $(window).load(function() { $('.html_sort_button').trigger('click'); }); })(jQuery); </script> <?php } elseif ( $_GET["psort"] == "photography" ) { ?> <script> (function($){ $(window).load(function() { $('.photography_sort_button').trigger('click'); }); })(jQuery); </script> <?php } }
As previously mentioned, you have to use the portfolio category slug as the value of the “psort” parameter in the url. So the url should look something like for the “html” items.
http://www.mysite.com/myportfolio?psort=html
And like this for the photograpy items:
http://www.mysite.com/myportfolio?psort=photography
Just make sure that the value psort parameter value is the same as portfolio category.
Regards,
IsmaelApril 20, 2015 at 3:08 pm #431316Thanks Ismael. I’ll try that
Colin
April 21, 2015 at 10:52 am #431870March 31, 2016 at 7:27 am #605675Hi there!!
I came here for the same reason and it also worked for me, but my question is that if it’s possible, when you click the trigger, to also scroll down to the section where the categories sorted are shown, because the link is quite higher than the portfolio.Thanks in advance!!!
March 31, 2016 at 7:57 pm #606163Hey!
it would require a huge amount of time and customization of the theme and that is why you would need to hire a freelance developer for this job.
Best regards,
AndyApril 6, 2016 at 6:31 pm #609106Well thank you Andy, the scroll thing it is resolved, but is it possible in code not to load the page when you make click? if it is, please let me know I’ll manage the way.
Thank you very much for your work, you are great guys!!
G.
April 9, 2016 at 12:55 pm #610570Hi,
Can you post the link to your website please?
Regards,
JosueApril 11, 2016 at 1:24 pm #611226Hi this is the link of the page:
http://websyapps.es/bluegold_test1/es/proyectos/
The trigger button is in angola country
Thank you for allApril 12, 2016 at 1:18 pm #611837Hey!
Why are you setting a delay of 2000 after the sort is triggered?
$("html, body").delay(2000).animate({scrollTop: $('#porfolio').offset().top }, 2000);
Best regards,
JosueApril 14, 2016 at 9:38 am #613628Sorry, I just copy-paste from a stack-overflow post and it worked, but actually I have no idea of what I’m really doing. So you can ignore it.
So why is this question closed?
- This reply was modified 8 years, 7 months ago by gofthet.
-
AuthorPosts
- The topic ‘Linking to filtered portfolio (ajax)’ is closed to new replies.