Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello there,

    I am getting the same error.

    I can select the gallery from within the page I want to display it on.

    I used the following code to pull the gallery in:

    <?php
    foreach ( get_field ( ‘nextgen_gallery_id’ ) as $nextgen_gallery_id ) :
    if ( $nextgen_gallery_id[‘ngg_form’] == ‘album’ ) {
    echo nggShowAlbum( $nextgen_gallery_id[‘ngg_id’] ); //NextGEN Gallery album
    } elseif ( $nextgen_gallery_id[‘ngg_form’] == ‘gallery’ ) {
    echo nggShowGallery( $nextgen_gallery_id[‘ngg_id’] ); //NextGEN Gallery gallery
    }
    endforeach;
    ?>

    Advanced Custom Fields – NextGEN Gallery Field add-on 2.0
    Advanced Custom Fields 4.3.9
    NextGEN Gallery by Photocrati 2.0.66.29

    CKFrantz

    (@ckfrantz)

    In the first line –

    foreach ( get_field ( 'nextgen_gallery_id' ) as $nextgen_gallery_id ) :

    You need to change ‘nextgen_gallery_id’ with the id of your gallery.

    HAHAHAAHAHA…?@ckfrantz No!

    You need to wrap the foreach in an if statement to insure $nextgen_gallery_id ≠ null.

    @ckfrantz – that worked for me.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I get: Warning: Invalid argument supplied for foreach()’ is closed to new replies.