• Hi All,

    I currently use a short code i manually put into posts so that an ad will appear in the middle of them. I set up the code in the functions.php so that i could put this shortcode in the html of posts.

    What i want to do is add some extra code to my functions.php file so that everytime i put in the short code for my ad unit the word ”Advertisement” will show above it. Like a title for it, so that visitors can clearly see that it is an ad unit.

    This is allowed by adsense isn’t it? I have seen sites in the past putting the word Advertisement above their ads.

    Many thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Might be a good idea to show exactly what you added to your functions.php file to make this work.

    Use backticks or the code option in the editor to paste your code. If it is a lot of code use something like pastebin.

    Thread Starter triplecomp

    (@triplecomp)

    Hi martcol,
    The code i used was this one
    http://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/

    So as you can see it allows me to just put in the shortcode to any post to show ad unit.

    Try adding <p>Text Here</p> immediately before the first <script> element making sure it’s after the first apostrophe, '

    If that works then obviously, you make the text as you want and you could also use a <h3> tag and give it a class for styling if you need to.

    This is not my strongest skill but it’s worth testing.

    Thread Starter triplecomp

    (@triplecomp)

    So something like this
    <p style=”text-align: center;”>
    <span style=”font-size:12px;”>Advertisement</span>
    </p>

    I tried it and it came up which is good and is centered but it made the ad unit align to the left when it was centered before adding the extra code

    I meant this addition to the WP Beginner code, paying attention to the apostrophe:

    return '<p>Text Here</p>
    	<script type="text/javas....

    And can you post a link to your site?

    Thread Starter triplecomp

    (@triplecomp)

    It’s ok I added the code i mentioned in my previous post and another separate align center code for the ad and it works.

    Thanks for your help

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add a title above ad unit?’ is closed to new replies.