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

BenderisGreat greglancaster71 at gmail.com
Mon Aug 12 17:24:26 UTC 2013

I got it kind of working, and thank you for your feedback.  Each post only
makes use of one tag, so currently choosing which tag shows isnt an issue. 
I do have an issue with both sidebars loading though.  I want it to look to
see if the custom sidebar exists and if not use the default.  heres the code
I came up with;
<?php global $post;
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag);{
$tag_name = $tag->name;}
$end =  $tag_name;

 <?php get_template_part('/templates/left-sidebar-'.$end.''); ?>  (this
checks for the left-sidebar with $tag appended)
<?php else: ?>
    <?php endif; ?>
	<?php get_template_part('templates/left-sidebar'); ?>      

Anyone have any idea how I can do that?  

View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/Help-with-including-custom-templates-using-variables-tp42014p42026.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.

More information about the wp-hackers mailing list