Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

Thanks

share|improve this question

1 Answer 1

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;

[my-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

 
discard

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.