-
AuthorPosts
-
November 30, 2020 at 12:52 am #1263840
Hi,
I have not yet been able to find a solution to my specific problem.
I have a link in my menu which I would like to anchor to an open ajax portfolio. I have been able to find a thread that defaults an ajax to open, but only if it is the first thing a user encounters on a page.
It is possible a deeplink to that specific Ajax would work, but I have not yet been able to successfully make that happen.
Preferably I would like the grid to default to All, but if a link is clicked in the menu, open Ajax portfolio preview.
December 2, 2020 at 5:10 pm #1264537Hey bnewman1,
Thank you for the inquiry.
Would you like to open a specific portfolio item on page load? If that is what you want, the following documentation should help.
// https://kriesi.at/documentation/enfold/portfolio-grid/#enable-deeplinking-to-the-portfolio-ajax
But instead of anchors, we will use query strings or URL parameters containing the ID of the portfolio item.
Example of a custom URL as shown in the documentation.
http://www.yoursite.com/your_portfolio_page?custom_ajax=12
Best regards,
IsmaelDecember 2, 2020 at 5:25 pm #1264541Hi Ismael,
Appreciate the reply – I unfortunately do not need the item to open on page load, but rather on the click of an item in the main menu.
I have updated the php file as suggested with the link above but am unable to create a link that will open the appropriate ajax portfolio preview.
Thanks!
December 7, 2020 at 4:41 am #1265376Hi,
Sorry for the delay. We could attach an event listener to the menu item so that when it is clicked, the corresponding portfolio item will open.
// https://api.jquery.com/click/
// https://www.w3schools.com/jquery/event_on.aspWe could use this function to open the portfolio item, or dispatch a click event based on the menu item that was clicked.
// https://api.jquery.com/trigger/
Best regards,
IsmaelDecember 7, 2020 at 11:02 pm #1265630No worries on the delay. I am not familiar with jquery at all. These changes would need to be made in the code placed in my php file?
Whichever you recommend.
Honestly if we could even just have the portfolio default to open without autoscrolling to the section, that would work fine. The site is basically a single page with anchor links in the menu. I just need the user to treat the first ajax portfolio preview like a section, and then have the other portfolios available to open if needed.
December 9, 2020 at 1:11 pm #1265980Hi,
Thank you for your patience.
Would you like the Graham Capital menu item to open the first AJAX portfolio item in the page? If this is what you need, please try to use this snippet in the functions.php file.
// trigger portfolio ajax on menu click function ava_script_events_container() { if ( wp_script_is( 'avia-default', 'registered' ) ) { wp_add_inline_script( 'avia-default', '(function($) { (function($) { $(document).ready(function() { // when the menu item with the ID 744 is clicked... $("#menu-item-744 a").on("click", function(event) { // prevent the default action.. event.preventDefault(); // , then dispatch a click event to the portfolio item with the ID 44 to open it $(".grid-entry.post-entry-44 a").trigger("click"); }); }); })(jQuery); '); } } add_action( 'wp_enqueue_scripts', 'ava_script_events_container', 9999);
As explained in the script comments, this will open the portfolio entry with the ID 44 when the menu item Graham Capital or the menu item with the ID 744 is clicked.
Best regards,
IsmaelDecember 9, 2020 at 6:49 pm #1266064Hi Ishmael,
That is what I need-Unfortunately this change to the PHP file did not cause any changes to site function.
Can you please advise? Really appreciate your help here.
Thank you!
-Alek
December 13, 2020 at 12:26 am #1266816Hi,
The script should attach a click event listener to the Graham Capital menu item. Did you test that menu item?
Would you mind if we access the dashboard and the file server so that we could test the modification? Please post the WP details in the private field and the FTP details as well if it is available. If FTP is not available, please make sure that the Appearance > Editor panel is accessible so that we could edit the files when necessary.
Thank you for your patience.
Best regards,
IsmaelDecember 14, 2020 at 6:52 pm #1267240This reply has been marked as private.December 16, 2020 at 1:19 pm #1267813Hi,
Thank you for the info.
The password for the username is incorrect, unfortunately. Please check it carefully or provide another valid account so that we could access the dashboard.
Best regards,
IsmaelJanuary 22, 2021 at 6:56 pm #1274841Hello,
I thought I had responded but it appears not. Please see below:
January 22, 2021 at 11:37 pm #1274870I figured it out! I was using the Portfolio slug not the Portfolio ID in the deeplink URL (which I was only able to figure out through using inspect element).
I appreciate all your help!
Perhaps in the portfolio grid deeplink instructions you could add a section clarifying how to access the Portfolio item ID, I think it would clear up the issue for a lot of people!
Thanks!!
January 23, 2021 at 6:34 am #1274914Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Portfolio Grid – Open to Ajax by Default’ is closed to new replies.