I'm trying to output content depending on if there are any tags within a post (1 or more)
I'm currently using this..
<?php if (count(get_the_tags($post->ID))>0): ?>
Content
<?php endif; ?>
..but it's not working and returns for posts with or without tags.
Anybody got a fix or another function I can use?
Thanks
Edit: fixed it now with this
<?php $testtags = get_the_tags($post->ID); if ($testtags): ?>
Content
<?php endif; ?>
Whoops!
nicktank
Member
Posted 2 years ago #
There is an easier way to pull this off. I'm using WP 2.8 with php5. Not sure if these template tags are available in all versions
`
<?php if(get_the_tags('count>=1'); { ?>
Print out some stuff here
<?php } else { ?>
this is results of there being no tags
<?php } ?>