WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

Hi I created a template within my theme files, just for displaying a map in a lightbox. I need to call this template page from a normal wordpress post, how can I do it?

Say in my theme files I have a file called map-template.php From within my post I would like to call that map-template.php file and also pass the ID of the current post as a parameter.


share|improve this question
up vote 1 down vote accepted

So long as you have a standard page template header in your map-template.php, you can use the Custom Post Template plugin (which essentially allows you use templates on posts in the same way you do with pages).

Update: Perhaps you might be better off using shortcode.

For example;

This is my post content in the editor. And here is a map;


And in functions.php;

function __my_map_shortcode()
     // output map
add_shortcode( 'my-map', '__my_map_shortcode' );
share|improve this answer
But I don't want to associate this template with any post or page. – drtanz Jun 6 '11 at 15:07
Having re-read your question, I think you might be better off using shortcode. See my revised answer. – TheDeadMedic Jun 6 '11 at 19:32
Yep; I would go the shortcode route. – Chip Bennett Jun 6 '11 at 19:40
ok thanks will try that out. – drtanz Jun 6 '11 at 20:16

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.