[resolved] [Plugin: NextGEN Gallery] Insert gallery into home.php template file (3 posts)

  1. micasuh
    Posted 6 years ago #

    I'd like to know how to successfully insert the shortcode into a template file instead of using it in a page or post. I know it's possible but I have no clue how to do it!

    I'm using the home.php file in my theme and would like to insert similar code as you would in a page:
    [nggallery id=1]
    I read that it has to be done using shortcode but I couldn't figure out why that doesn't work. Or maybe it's because I didn't enter anything in my functions.php file. I really don't know but hope someone else does!


  2. micasuh
    Posted 6 years ago #

    So I viewed this thread thinking it was the solution:

    After lots of testing, I was frustrated. I finally saw another suggestion and added my comment to the above thread.

    Use this code in any template file and it should work:
    <?php echo do_shortcode('[nggallery id=x w=width h=height]'); ?>

  3. chrisboggs
    Posted 5 years ago #

    @micasuh Thanks alot for posting your answer. It is very much appreciated. Happy New year to you sir! -c-

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.