search the content for a string, and a conditional
-
Hi there. I’d like to either show the content, or not, based on whether a certain string is found in the content itself. This is what i have, but it’s not working:
<?php $thecontent = basename(the_content(10)); if(strpos($thecontent, '[flickr') > 0): ?> <p>Show text 1</p> <?php else :?> <p>Show text 2</p> <?php endif;?>
First off, the content gets shown on the page because of the variable assignment. Then the conditional doesn’t seem to work. Any suggestions?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘search the content for a string, and a conditional’ is closed to new replies.