WordPress.org

Ready to get started?Download WordPress

Forums

if function works, but appears in plaintext on the site too (1 post)

  1. Ollie Ford
    Member
    Posted 1 year ago #

    Hi, I can't figure out how to get round this, I only tinker with PHP through using WordPress, so I'm sure it's a pretty simple fix.

    I'm trying to display a brief message to adblock users, in place of the ad.

    So here's the portion of code from sidebar.php:

    <script>
    //Google AdSense stuff..
    </script>
    
    if (typeof(window.google_render_ad) == "undefined") {
    <div id="adblock">
    //My message
    </div>
    }

    But on the page, I see the message, but also the if code before and after.

    I tried putting the whole if(){} statement in <?php ?> tags, but that screwed with the whole formatting of the page, and the message didn't display at all.

    Thanks in advance for any tips.

Topic Closed

This topic has been closed to new replies.

About this Topic