Additional header using mobile only code

resolved (6 posts) (2 voices)

  1. Hi.

    I was trying to add a google ad to the top of my site using the addtional header section.

    I wanted this ad only to be displayed when in responsive mode and was trying to use the "mobile only" function.

    I put the code into the additional header section and wrap it in the mobile code. However when I go into the desktop version of the site it still displays the ad there and you can see the [mobile_only] code displayed.

    Is there a way to use the mobile only code in the additional header section?

    Thanks, James

    Posted 3 years ago #
  2. Elliott

    Hello DolNeedPermission,

    To use shortcodes inside PHP files you need to use the do_shortcode function.

    Or you could just use CSS, send us a link.

    Posted 3 years ago #
  3. Hi Elliott.

    How would a add the do_shortcode function to the PHP files?

    The website is

    Thanks. James

    Posted 3 years ago #
  4. Elliott.

    Do I just put <?php echo do_shortcode( $content ) ?> into the header php file?

    Does it matter where in the PHP file i put the code?

    Thanks, James

    Posted 3 years ago #
  5. Elliott

    You would place it wherever you want to display the shortcode. And you would replace $content with your shortcode like so,

    <?php echo do_shortcode("[button]text[/button]"); ?>

    Posted 3 years ago #


You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme