NextGen Gallery - Using Custom Field to insert gallery (Not the plugin) (7 posts)

  1. Danny Albeck
    Posted 5 years ago #


    I know there is quite a few threads and resources on this subject matter but the trend I am finding for the little extra modification of getting the custom theme to work is no one is posting the solution after they get it working, the replies end with "I got it to work thanks" not "I got it to work and this is how...". So I apologize for bringing this up again.

    Basically what I am looking to do is use NextGen Gallery, and WordPress custom field functionality. I just want to enter in the gallery ID I am looking to embed on the page and then have it display using the Gallery View template. I have stumbled across the following links and I am just going in circles not getting this to work properly, and I am not sure if my PHP code in my page.php file is 100% correct. Any help on this matter would be great, and I created the nggallery folder in my custom theme directory, and uploaded the gallery-galleryview.php in to it.

    Here is the PHP code in my file:

    <?php  /* NG Gallery Custom Field Rotating Images  */
    						 $gallery = get_post_meta($post->ID, 'gallery', true);
    						 $gal = $gallery;
    						 if( !empty($gal) )
    						 $nggtemplate = "template=galleryview images=0";
    						 $gal = apply_filters('the_content', $gal );
    						 echo $gal;

    I got this from reading the following threads and sites online:

    1) http://wordpress.org/support/topic/plugin-nextgen-gallery-nextgen-carousel?replies=10
    2) http://translate.google.com/translate?hl=en&sl=nl&tl=en&u=http%3A%2F%2Fwww.doede.net%2Fwordpress%2Fhandleidingen%2Fnextgen-carrousel-template-op-maat%2F <-- (member here on the forum who has accomplished what I am looking to do, so I hope you can reply :) )
    3) http://mygraphicfriend.wordpress.com/2010/01/11/custom-style-sheet-and-templates-for-nextgen-gallery-with-special-instructions-for-child-themes/
    4) http://nextgen-gallery.com/templates/galleryview/
    5) http://www.kimwoodbridge.com/using-wordpress-custom-fields-to-display-nextgen-gallery-slideshows-conditionally/

    Those are basically of the links I have stumbled upon, but I can't get the gallery to load in the gallery view theme, and I have spent countless hours on something that I am sure is super easy and I am just overlooking at this point from starring at it for so long. Thank you to everyone who chimes in and can help me out here!

  2. jimmyink
    Posted 5 years ago #

    Maybe try -

    <?php  /* NG Gallery Custom Field Rotating Images  */
    $gallery_id = get_post_meta($post->ID, 'gallery', true);
    if( !empty($gallery_id) ){
    	$ngg_shortcode = '[ nggallery id=' . $gallery_id . ' template=galleryview images=0 ]';
    	echo do_shortcode($ngg_shortcode);

    I haven't tested it, so it may still need some tweaking.

  3. Danny Albeck
    Posted 5 years ago #


    Unfortunately, the page just displays:
    [ nggallery id= template=galleryview images=0 ]

    anybody have any input? I wish I could get in touch with: Rhand from the first link I provided but his site is in another language and the translator doesn't do too well on the form and no way of direct contact on here. It seems like he got it to work.

    This has been driving me crazy though, I do appreciate your input Jimmy, maybe you or someone else has another idea on it.

    Thanks again!

  4. Danny Albeck
    Posted 5 years ago #

    Anyone have any ideas..? I could really use some help on this.

    Thank you.

  5. Danny Albeck
    Posted 5 years ago #

    Anyone come up with any fix for this?

    Thank you, I am sorry to keep spamming the thread, but I could really use a hand getting this to function.

  6. jimmyink
    Posted 5 years ago #

    Just did some extra research, try the 'nggShowAlbum' function. There's some instructions here:


    Goes without saying, make sure you are using the latest version of WP and NGG. I don't have the time to test this (at work) but I'm pretty confident 'nggShowAlbum' should work. I'll leave the fun part up to you :)

  7. emma.echter
    Posted 5 years ago #

    From your link;


    I was able to get my gallery functioning as needed.

    If you copy and paste the code from the example into the template where you want it, then when you're entering the custom field info, change this to the same text as you would to display the gallery in the post eg:

    [slideshow=1, width=100, height=50]

    I used this method to move the gallery out of the main content so that I could control which page styles it was displayed on. I am using Tanzaku theme, so i only wanted it in the single post view, not the grid view (which is all the posts at once).

    So, you just change slideshow to whichever view you want.

    Hope this helps. It sounds like this is what you mean.

Topic Closed

This topic has been closed to new replies.

About this Topic