Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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.

    #1264537

    Hey 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,
    Ismael

    #1264541

    Hi 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!

    #1265376

    Hi,

    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.asp

    We 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,
    Ismael

    #1265630

    No 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.

    #1265980

    Hi,

    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,
    Ismael

    #1266064

    Hi 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

    #1266816

    Hi,

    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,
    Ismael

    #1267240
    This reply has been marked as private.
    #1267813

    Hi,

    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,
    Ismael

    #1274841

    Hello,

    I thought I had responded but it appears not. Please see below:

    #1274870

    I 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!!

    #1274914

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Portfolio Grid – Open to Ajax by Default’ is closed to new replies.