Title: Global custom code
Last modified: April 27, 2022

---

# Global custom code

 *  Resolved [Pixyweb](https://wordpress.org/support/users/pixyweb/)
 * (@pixyweb)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/global-custom-code/)
 * Hi,
 * It’s possible to add a custom code below an ad.
    Is it possible to add a global
   custom code for all ads?
 * Thanks for your help.
 * Regards,
    Greg

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [schmidt25](https://wordpress.org/support/users/schmidt25/)
 * (@schmidt25)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/global-custom-code/#post-15595597)
 * Hi Greg,
 * Thanks for reaching out.
 * > It’s possible to add a custom code below an ad.
 * You can add custom codes to your ads using Advanced Ads Pro, for example, to 
   modify ads to have rounded corners. Here, you can find the [manual about adding custom code to your ads](https://wpadvancedads.com/how-to-add-custom-code-in-css-and-html-to-your-ads/).
 * > Is it possible to add a global custom code for all ads?
 * If this is possible depends on what you want to achieve exactly.
 * In general, each placement has an own class that you can address with global 
   custom CSS. You can also [add individual classes to single ad units in the layout section](https://wpadvancedads.com/manual/optimizing-the-ad-layout/#Container_Classes).
 * I hope that helps you.
 * Best regards,
    Joachim
 *  Thread Starter [Pixyweb](https://wordpress.org/support/users/pixyweb/)
 * (@pixyweb)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/global-custom-code/#post-15595885)
 * Hi Joachim,
 * Thank you for your prompt reply. 👍
 * What I want to achieve is to display the same message below all banners.
    In 
   fact I would like to display the following message “Click here to publish your
   ad”. Instead of adding this message as a custom code for each ad it would be 
   great to have this message added automatically.
 * Do you understand what I mean?
 * Best Regards,
    Greg
 *  Thread Starter [Pixyweb](https://wordpress.org/support/users/pixyweb/)
 * (@pixyweb)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/global-custom-code/#post-15600558)
 * Hi Joachim,
 * Is it possible to do what I want or not?
    Thanks for your help.
 * Best Regards,
    Greg
 *  [schmidt25](https://wordpress.org/support/users/schmidt25/)
 * (@schmidt25)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/global-custom-code/#post-15601278)
 * Hi Greg,
 * Thanks for your explanation. I understand what you mean.
 * There is not such a function out of the box, and I also searched in our custom
   code section for anything related. You might also take a look at our [codex](https://wpadvancedads.com/codex/).
 * I was thinking about the easiest way to solve this. How about using the ad label
   function for your purpose?
 * You can find a description in the [ad label tutorial](https://wpadvancedads.com/manual/ad-label-how-to-set-advertisement-label/#Customizing_the_ad_label_for_CSS_professionals)
   on how you can address this with CSS. I would try to link these ad label elements
   globally afterward.
 * Best regards,
    Joachim
 *  Thread Starter [Pixyweb](https://wordpress.org/support/users/pixyweb/)
 * (@pixyweb)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/global-custom-code/#post-15601411)
 * Hi Joachim,
 * I try with the the ad label but it’s only text, I cannot insert HTML. How can
   I do if I want to add a link to the text?
 * Best Regards,
    Greg
 *  [schmidt25](https://wordpress.org/support/users/schmidt25/)
 * (@schmidt25)
 * [4 years ago](https://wordpress.org/support/topic/global-custom-code/#post-15602577)
 * Hi Greg,
 * You would add the HTML externally by addressing the ad label class.
 * I thought about this issue again. The workaround via the ad label is not elegant.
   You could technically replace the ad label text and insert a link with custom
   code. This is not my specialty, and you can find better examples on StackOverflow,
   but basically, you could do it like in [this example](http://jsfiddle.net/arunpjohny/KsRKg/).
 * However, it would be more elegant not to replace and rewrite the ad label but
   to automatically place the custom code above the elements of the placements, 
   which each have their classes. From experience, most websites don’t have more
   than a dozen placements, somewhat significantly fewer. It would therefore be 
   cleaner to include your code in front of the elements of these classes than to
   manipulate the ad label.
 * You can find code examples on StackOverflow, e.g., [here](https://stackoverflow.com/questions/7378097/add-text-before-or-after-an-html-element).
 * This method would still mean less effort than adding custom code to every ad.
 * I have one last workaround that doesn’t require you to write any code.
 * 1. Build the text link you want to display above the ad using Advanced Ads.
    
   2. Create an ad group for each placement in [ordered group mode](https://wpadvancedads.com/manual/ad-groups/#Ordered_Ads)
   and give this ad the highest ad weight. 3. Set the number of visible ads to 2.
 * The ad with the text link will always be displayed before the other ad of this
   placement. This seems to be the most straightforward and cleanest variant of 
   all possibilities.
 * Best regards,
    Joachim
 *  Thread Starter [Pixyweb](https://wordpress.org/support/users/pixyweb/)
 * (@pixyweb)
 * [4 years ago](https://wordpress.org/support/topic/global-custom-code/#post-15607314)
 * Hi Joachim,
 * Thanks again for your help.
 * I follow your any code solution, it works great.
 * Best Regards,
    Greg
 *  [schmidt25](https://wordpress.org/support/users/schmidt25/)
 * (@schmidt25)
 * [4 years ago](https://wordpress.org/support/topic/global-custom-code/#post-15608644)
 * Hi Greg,
 * Great to hear this good news.
 * Next time, I’ll be faster in pointing out how easy it is to solve this problem
   🙂
 * Best regards,
    Joachim

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Global custom code’ is closed to new replies.

 * ![](https://ps.w.org/advanced-ads/assets/icon-256x256.gif?rev=2773443)
 * [Advanced Ads – Ad Manager & AdSense](https://wordpress.org/plugins/advanced-ads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-ads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-ads/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-ads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-ads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-ads/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [schmidt25](https://wordpress.org/support/users/schmidt25/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/global-custom-code/#post-15608644)
 * Status: resolved