Tags as variables
-
I have 25 tags on my site, and I wish to have a unique PHP snippet included in my sidebar for each tag.
I can do individual if /elseif statements, 25 times, and that will work OK…
<?php if (is_tag( ‘tag1’ )) { include (‘includes/tag1.php’); }
elseif (is_tag( ‘tag2’ )) { include (‘includes/tag2.php’); }
elseif (is_tag( ‘tag3’ )) { include (‘includes/tag3.php’); }
else ?>But what I’d like to do instead is use a variable, since my include filename matches the tag, so I don’t have to do all the elseif’s. Is there a way I can do this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Tags as variables’ is closed to new replies.