WordPress.org

Ready to get started?Download WordPress

Forums

How can I hide a header code on desktop? (5 posts)

  1. mojican
    Member
    Posted 5 months ago #

    I have an adsense code in my header but I want to hide it on desktop view and make it only viewable in mobile. Is that possible?

    themusicstash.com

  2. Dave Naylor
    Member
    Posted 5 months ago #

    You could make use of the core function wp_is_mobile()

    Codex page here

  3. mojican
    Member
    Posted 5 months ago #

    Thanks for the reply. I'm very new with this stuff.
    Would i paste this code <?php wp_is_mobile(); ?> and then my google adsense code?

  4. Dave Naylor
    Member
    Posted 5 months ago #

    No, it's a bit more involved than that. If you look at the codex page, it shows you how to wrap your code in an if statement. You need a certain familiarity with PHP to do that.

  5. mojican
    Member
    Posted 5 months ago #

    Ok thanks. I'll take a look

Reply

You must log in to post.

About this Topic