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/
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]'); ?>
chrisboggs
Member
Posted 1 year ago #
@micasuh Thanks alot for posting your answer. It is very much appreciated. Happy New year to you sir! -c-