[wp-hackers] Help with including custom templates using variables

J.D. Grimes jdg at codesymphony.co
Tue Aug 13 12:37:20 UTC 2013


> I am still learning php, so I apologize for the questions.  Can you point me
> in the right direction to learn how to do this?

Just create the sidebar template like you would have for one of the single tags, but instead of hard-coding things, make them dynamic. For example, where you would have put the tag name like "My Cool Tag", instead do something like this:

<?php echo $tag->name; ?>

You will need to get the tag, the same way that you are before you load the template. Or you may not need to get the tag at all until inside of the custom sidebar template (that depends on whether you know you are going to load that template before you check the post's tags).

If you post an example of what you are trying to achieve, we can help you make it dynamic.

- J.D.


More information about the wp-hackers mailing list