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]
  • 2
    What did you do on the posts page? Can you edit your question to include the code? Nov 16, 2012 at 15:40
  • @ChipBennett Plz see edit
    – asf
    Nov 16, 2012 at 15:45
  • By "code on posts page", I assume you mean code entered into the Post Editor? Nov 16, 2012 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, 2012 at 15:59

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.