WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to add gallery with Thickbox effect(Pop up), i achieved this easily on the posts page by using WordPress gallery and the lightbox plugin.But the theme is custom made there is a footer.php.I don't know how to add this gallery to the footer pro grammatically please help

EDIT:Code on Posts Page

<a href="http://mysite.com/wp-content/uploads/2012/10/image.png">[gallery]
share|improve this question
What did you do on the posts page? Can you edit your question to include the code? – Chip Bennett Nov 16 '12 at 15:40
@ChipBennett Plz see edit – asf Nov 16 '12 at 15:45
By "code on posts page", I assume you mean code entered into the Post Editor? – Chip Bennett Nov 16 '12 at 15:54
@ChipBennett I went to the posts page and and from the inserted the gallery from the visual editor and the code is obtained from the html version of the editor(html tab) – asf Nov 16 '12 at 15:59
up vote 1 down vote accepted

Since the gallery is rendered via a [gallery] shortcode, you can try using do_shortcode() in footer.php. For example, assuming you want to output a gallery with an ID of 1:

<?php echo do_shortcode( '[gallery id="1"]' ); ?>
share|improve this answer
Thanks tried it but all i got was echo do_shortcode( '[gallery id="1"]' ); printed on the Homepage – asf Nov 16 '12 at 15:56
It's PHP code, and thus needs to be wrapped in <?php / ?> tags. – Chip Bennett Nov 16 '12 at 16:00
Added it.Now nothing is printed but the gallery is not shown – asf Nov 16 '12 at 16:03
What are you using for $id? Are you sure a gallery with that ID exists? – Chip Bennett Nov 16 '12 at 16:08
"How can i find the id of the gallery?" - Use the ID of the post to which the gallery is attached. – Chip Bennett Nov 16 '12 at 16:15

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.