• Resolved katmac_aus

    (@katmac_aus)


    Hello. I am using the nextgen image browser in some pages of my site.

    When you view the page with the gallery in it directly, it works. Eg https://www.mydomain.com/product1.

    However, the way my site is setup is that in some sections of the site, page content is loading into other pages via a WP Query. When done this way, the gallery is visible but click on the next button does nothing. No errors shown in console. Just spins and no photo changes happen.

    I assume this may be because it doesn’t load a script or add some code like it does when you show the page “normally”. But I dont know what scripts I should be telling it to run.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @katmac_aus – Unfortunately without knowing the details and specifics of your WP_Query call it’s very difficult to say what may or may not be missing … the first thing to review (as a quick thought) is how the NextGEN Gallery inserted display details are being generated?

    Thanks!

    – Cais.

    Thread Starter katmac_aus

    (@katmac_aus)

    Let me provide some more detail. I have a page called category which runs a WP Query to get a specific product page. The product page is displayed within the category page with get_template_part('content');.

    In the content template, it gets a custom variable that stores the ID of the gallery to display. It then displays the gallery as follows:

    <?php echo do_shortcode('[ngg_images source="galleries" container_ids="'.$gallery_id.'" display_type="photocrati-nextgen_basic_imagebrowser" ajax_pagination="1" order_by="sortorder" order_direction="ASC" returns="included" maximum_entity_count="500"]'); ?>

    This works to output the product with the next gen image browser on the page, within the category page. EG the page contains…

    Category heading
    Category content
    Specific Product – title, gallery blurb

    You can see the gallery but clicking on the buttons does nothing.

    But when you view product pages individually the galleries work.

    This is why I am thinking that this method is not triggering some script to load???

    Thread Starter katmac_aus

    (@katmac_aus)

    Update: I noticed that the code is actually running and it does get as far as sending the ajax request but the repsonse does not work. I think this is because the page URL has a query parameter in it which mucks up the next gen JS. Eg the page url is mydomain.com/category?pid=1.

    Thread Starter katmac_aus

    (@katmac_aus)

    SOLVED! This is was indeed the use of query strings in the url. I updated nextgen_gallery_display/common.min.js with code from common.js and edited it to remove the query string from url parameter in the AJAX request as follows (from line 40):

    var full_url = $(this).attr('href'); 
    var url_parts = full_url.split("?"); 
    var pre_url = url_parts[0];
    				
    // Send the AJAX request
    $.get(pre_url, function (response) {
       //continue normal code...
    
    Plugin Contributor photocrati

    (@photocrati)

    @katmac_aus – Thanks for the updates!

    Please feel free to send us a PR with your changes, otherwise you may need to keep a back-up reference to your changes and make them with each update.

    Here is our public repo: https://bitbucket.org/photocrati/nextgen-gallery

    Thanks, again!

    – Cais.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘NextGen Image Browser when page added via WP Query.’ is closed to new replies.