WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. micasuh
    Member
    Posted 4 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!

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. micasuh
    Member
    Posted 4 years ago #

    So I viewed this thread thinking it was the solution:
    http://wordpress.org/support/topic/261872

    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
    Member
    Posted 3 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

Tags

No tags yet.