Support

Account

Home Forums General Issues Display Nextgen Gallery

Solving

Display Nextgen Gallery

  • How can I display a Nextgen Gallery in a custom loop (in a CPT single page template)?

    I have taken the following steps:
    1. created ACF field set with a field ‘blog-article-body’ with field type WYSIWIG editor
    2. applied the ACF field set to a CPT ‘article’
    3. added a nextGen gallery on an ‘article’ via the WYSIWIG editor
    4. retrieved the field value using code ‘echo get_field(‘blog-article-body’);
    5. this displays the following error when previewing the page:

    Default Gallery Type Template
    This is the default gallery type template, located in:
    /var/www/vhosts/example.com/playground.example.com/wp/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/templates/index.php.
    
    If you're seeing this, it's because the gallery type you selected has not provided a template of it's own.
    
    ” template=”/var/www/vhosts/example.com/playground.example.com/wp/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/view/gallery-carousel.php” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″]

    I read somewhere this might be related to transforming the shortcode using do_shortcode(). Any pointers to how to solve this issue are much appreciated.

  • I have done some further testing to see where the problem arrises.

    1. From https://www.imagely.com/docs/nextgen-gallery-shortcodes/#gist21867672 take the shortcode [ngg_images gallery_ids=1 display_type=photocrati-nextgen_basic_thumbnails disable_pagination=1 images_per_page=1 show_all_in_lightbox=1] and paste it into an ACF field with a WYSIWIG editor
    2. preview: gallery will show fine
    3. edit the Nextgen gallery by clicking on the pen icon in the Nextgen gallery icon in your WYSIWIG content
    4. change which gallery should be displayed and hit ‘Insert Displayed Gallery’
    5. preview the post. The error If you're seeing this, it's because the gallery type you selected has not provided a template of it's own. is displayed
    6. now compare the shortcode above with the current shortcode: it has many differences

    Above shortcode after editing the gallery to be displayed using the ‘edit-gallery’ button:

    
    [ngg_images source="galleries" container_ids="2" display_type="photocrati-nextgen_basic_thumbnails" override_thumbnail_settings="0" thumbnail_width="240" thumbnail_height="160" thumbnail_crop="1" images_per_page="1" number_of_columns="0" ajax_pagination="0" show_all_in_lightbox="1" use_imagebrowser_effect="0" show_slideshow_link="0" slideshow_link_text="[Show slideshow]" order_by="sortorder" order_direction="ASC" returns="included" maximum_entity_count="500"]
    

    Related issues: https://support.advancedcustomfields.com/forums/topic/wysiwyg-field-not-displaying-nextgen-gallery-2/

  • I did some looking at this and the reason it does not work is as James said in the other topic.

    I don’t use NGG, so I can’t promise this will work, or that it is bug free, this is really just a guess

    
    // add to functions.php
    add_action('init', 'add_NGG_actions_to_acf');
    function add_NGG_actions_to_acf() {
      if (class_exists('C_NextGen_Shortcode_Manager')) {
        $instance = C_NextGen_Shortcode_Manager::get_instance();
        add_filter('acf_the_content', array(&$instance, 'fix_nested_shortcodes'), -1);
        add_filter('acf_the_content', array(&$instance, 'parse_content'), PHP_INT_MAX);
      }
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Display Nextgen Gallery’ is closed to new replies.