[wp-hackers] Including Sidebar Content via Conditionals Within Same File

BenderisGreat greglancaster71 at gmail.com
Thu Aug 15 20:18:19 UTC 2013


I have been working at this for an hour, and hoping someone here can chime in
and solve it quick for me.  Calling left sidebar, and I would like to have
the sidebar determine what content to show based on the post tag.  This is
what I have;


/<?php global $post;
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag);{
$tag_name = $tag->name;}
$end =  $tag_name;
?>


<php if $end = 'help';
return '

<div class="widget">
Help Gallery


<div class="widget-inner">
<?php echo do_shortcode('[ngg_images gallery_ids="1"
display_type="photocrati-nextgen_basic_thumbnails"]'); ?>
</div>
</div> '; ?>
<?php endif; ?>/

I did this with three items, but it shows all of them on every page so I
assume I am using the include statament wrong.  I am still learning php, but
I think maybe I should be using the phpDOM function?  Not entirely sure, but
definitely confused how to make this work.  I just need the sidebar to match
the post tage name ($end) to the correct section of the file and return it.  

Any help greatly appreciated!



--
View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/Including-Sidebar-Content-via-Conditionals-Within-Same-File-tp42060.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.


More information about the wp-hackers mailing list