Support » Plugin: Advanced Custom Fields: NextGen Gallery Custom Field » Nothing shows on page, just "Array"

Viewing 9 replies - 1 through 9 (of 9 total)
  • I am seeing a similar issue on my end – everything appears to be set up correctly, but I still only see the word “Array” where my gallery should appear. Were you able to find any resolution for this?

    Thread Starter kingmaico

    (@kingmaico)

    Here’s the code I used and it worked for me:

    <?php
    $post_id = $GLOBALS['post']->ID;
    $fotogalerie = get_field('fotogalerie',$post_id);
    ?>
    
    <aside class="sidebar sidebar-reisdetails widget-area" itemtype="http://schema.org/WPSideBar" itemscope="itemscope" role="complimentary">
       <ul>
          <?php
    	  if ($fotogalerie){
    		echo '<li class="widget widget_text"><h4 class="widget-title widgettitle">Foto impressie</h4>';
    		foreach ( $fotogalerie as $var ) {
    			$ngg_id = $var['ngg_id'];
    			$ngg_form = $var['ngg_form'];
    			}
    		  echo do_shortcode('[ngg_images gallery_ids="'.$ngg_id.'" display_type="photocrati-nextgen_basic_thumbnails"]');
    		  echo '</li>';
    		  } // end if fotogalerie
    
    	?>
       </ul>
    </aside>
    Thread Starter kingmaico

    (@kingmaico)

    thanks for the followup! Did you place this code in your Functions file or within your template where the field is supposed to appear?

    Thread Starter kingmaico

    (@kingmaico)

    I’ve placed the code in the sidebar template not in functions.php.
    I hope this solves your puzzle as well.

    I’m trying to use this code and substituted “fotogalerie” with “photo_gallery” since that’s the name of my custom field. However, now instead of “Array”, I get “no images found” for my attached gallery, even though I’ve made sure all images are accounted for as well made sure they insert properly as a gallery in a regular post. Is there anything else I’m missing?

    Thread Starter kingmaico

    (@kingmaico)

    I use version: 2.0.66.29
    That’s the most recent version.
    I believe I actually upgraded the plugin because of this issue.

    And I just checked… I also downloaded an extra plugin that adds next gen as a type of field to advanced custom fields: Advanced Custom Fields – NextGEN Gallery Field add-on

    Sorry I didn’t mention it earlier

    I’m using that plugin too, which was giving me this issue.

    I managed to solve the problem though, using parts of your explanation!

    First in ACF (with the NG add-on enabled), I created the custom field and made sure the output of the field was for the NextGen Gallery ID (not an array of images). I called the custom field photo_gallery.

    Then in my template, I used the following code:

    $post_id = $GLOBALS['post']->ID;
    $photo_gallery = get_field('photo_gallery',$post_id);
    ?>
    <?php
     if ($photo_gallery){
    echo '<h4 class="widget-title widgettitle">More Images</h4>';
    echo do_shortcode('[ngg_images gallery_ids="'.$photo_gallery.'" display_type="photocrati-nextgen_basic_thumbnails"]');
     } // end if photo_gallery
    ?>

    This way, the shortcode is enabled and the spot where the ID number goes is where my custom field’s output is placed and the shortcode does the rest. Just tested it out and it worked!

    Thank you so much for your helpful code, it definitely helped me fix the issue. I hope anyone else who finds this thread finds the above info useful.

    Thread Starter kingmaico

    (@kingmaico)

    Great you solved it.
    Many roads lead to Rome, especially in php.
    Good luck finalizing your project.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Nothing shows on page, just "Array"’ is closed to new replies.