• Can I somehow add for example a PHP-code that checks the Title or the Tags of the post. And if the post Title/Tags contain a word, then it won’t show a bit of HTML.

    Like:

    If Title/Tags contain “Hey” then DO NOT show code{
    <h1>This post does not contain “Hey”
    }

    Can anyone please help me with this?

Viewing 1 replies (of 1 total)
  • Thread Starter Axelzzon

    (@axelsson)

    This code works:

    <?php
    $string = “YOURWORD”;
    $container = $post->post_title;

    if(strstr($container,$string)) {
    echo “found it.”;
    } else {
    echo “not found.”;
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘“If the Title/Tags doesn’t contain XXX then show post”?’ is closed to new replies.