
-
AuthorPosts
-
December 14, 2021 at 8:32 pm #1332858
Hi, in my main navigation, I have direct links to ajax portfolio items. They were working just fine up until maybe a month or so ago. Can you please help?
To recreate… hover over Resources in the main navigation. Then click Brand Package under Team Velocity. This SHOULD open the Team Velocity resources page and automatically show the Brand Package ajax portfolio item open on the page. However now it simply does nothing.
My url for the direct link looks like this: https://my-glovebox.com/resources/team-velocity/?custom_ajax=116
What’s odd is that it won’t work the first time you click the link, but it will work if you click the link a 2nd time.
-
This topic was modified 3 years, 7 months ago by
ToniMalena. Reason: added login credentials
December 15, 2021 at 1:28 pm #1332949Hey ToniMalena,
Thank you for the inquiry.
We get the following error in the console when we go to the Team Velocity page, which might be due to the Performance > File Compression settings. Please disable the compression settings temporarily so that we can locate the script where the error occurs.
Uncaught TypeError: Cannot read properties of undefined (reading 'addClass') at Object.show_item (avia-footer-scripts-07c8ca6e9ef6dc604f88c80532ccaf67---618a9c3e07e05.js:105) at s.fn.init.single_callback (avia-footer-scripts-07c8ca6e9ef6dc604f88c80532ccaf67---618a9c3e07e05.js:106) at i.AviaPreloader.trigger_loaded (avia-footer-scripts-07c8ca6e9ef6dc604f88c80532ccaf67---618a9c3e07e05.js:33) at i.AviaPreloader.checkImage (avia-footer-scripts-07c8ca6e9ef6dc604f88c80532ccaf67---618a9c3e07e05.js:33) at avia-footer-scripts-07c8ca6e9ef6dc604f88c80532ccaf67---618a9c3e07e05.js:32
Best regards,
IsmaelDecember 15, 2021 at 3:54 pm #1332983Okay, I disable the Javascript file merging and compression. The CSS compression was already disabled. Let me know if I need to do anything else for you to troubleshoot.
December 16, 2021 at 11:37 am #1333100Hi,
Thank you for the update.
The error occurs in the portfolio.js file around line 202..
portfolio.js?ver=5.8.2:202 Uncaught TypeError: Cannot read properties of undefined (reading 'addClass') at Object.show_item (portfolio.js?ver=5.8.2:202) at s.fn.init.single_callback (portfolio.js?ver=5.8.2:292) at $.AviaPreloader.trigger_loaded (shortcodes.js?ver=4.8.7.1:944) at $.AviaPreloader.checkImage (shortcodes.js?ver=4.8.7.1:933) at shortcodes.js?ver=4.8.7.1:928
.. in this code.
content_retrieved[post_id].addClass('open_slide');
The post_id is not defined.
How do you execute or open the portfolio preview on load? Please post the script using pastebin or any online snippet tool.
Best regards,
IsmaelDecember 16, 2021 at 3:57 pm #1333138Oh, okay. So I added this to the functions.php: https://pastebin.com/yF0XzkHs
Then I add the following string to the end of the page’s URL: ?custom_ajax=116 (substitute the number at the end for the portfolio item’s number)
Is there a different way that I should try opening the portfolio preview on page load?
December 18, 2021 at 4:33 am #1333316Hi,
Thank you for the info.
In the enfold_customization_portfolio_linking function, try to look for this line..
jQuery('.post-entry-'+p+' .grid-image').click();
.. and replace it with.
jQuery('.post-entry-'+p+' .grid-image').trigger("click");
Best regards,
IsmaelJanuary 3, 2022 at 4:28 pm #1334075Hi, Ismael! I tried that. Still no luck.
January 4, 2022 at 6:43 am #1334140Hi,
Thank you for the update.
We modified the script a bit and added a timeout so that it doesn’t execute immediately on page load. It is working correctly now. Please make sure to purge the cache before checking.
// deep linking to Portfolio Ajax add_action( 'wp_footer', 'enfold_customization_portfolio_linking', 999 ); function enfold_customization_portfolio_linking() { ?> <script type = "text/javascript"> (function($) { $(document).ready(function(){ setTimeout(function() { $('.post-entry-'+ getUrlParameter('custom_ajax') +' .grid-image').trigger("click"); }, 500); }); })(jQuery); function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } </script> <?php }
Best regards,
IsmaelJanuary 4, 2022 at 3:39 pm #1334215Oh my gosh. Thank you SO much. That did work. :)
January 5, 2022 at 3:31 am #1334294 -
This topic was modified 3 years, 7 months ago by
-
AuthorPosts
- The topic ‘Direct Link to Ajax Portfolio Item’ is closed to new replies.