Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.


im using NextGen gallery for my gallery images, i want to display in archive page first 4 images from the galley atached to the post.

Ex: i have this code that retrive me the galery..

    foreach ( get_field ( 'galerie_seriale' ) 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

Please see the picture http://i49.tinypic.com/wwdkd0.jpg

I want to be able to get in archive page only 4 picture, first 4 pictures, last.., something like this http://www.tvblog.ro/seriale-tv/

I search

share|improve this question
Do you use a good code editor? Like NotePad++, SublimeText... Drop the plugin folder in it and search for function nggShowGallery, there are parameters and filters that may be useful. –  brasofilo Feb 3 '13 at 21:10
I use Dreamweaver Cs6 –  Batman Feb 3 '13 at 23:07

1 Answer 1

thI found a solution i think

    //Show 6 random images using 'my-template' from gallery 4
    //(order, number of images, template, gallery ID)
    echo nggShowRandomRecent('order', 6, 'my-template', 24);

This code it retrive me 6 images, now the question is : how can i put custom_field inside that function..

EX: 24- is the id of the galeryy.. I select the galerry with custom_field - galerie_seriale

How can i put it togeder?

I came UP with this code, it retrive me the galley.. now the question si .. is corect made?

$poze = get_field('galerie_seriale');
if ($poze) {
    echo nggShowRandomRecent('order', 4, 'my-template', $gallery_field );

This code it retrive me the galery but for other post it retrive me the same..

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.