Title: Using AdInserter Shortcode
Last modified: November 15, 2024

---

# Using AdInserter Shortcode

 *  Resolved [tbalcie](https://wordpress.org/support/users/tbalcie/)
 * (@tbalcie)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/)
 * Hello,
 * supernice tool is this!
 * I wanted to add the AdInserter shortcode to a texfield for this Advent plugin,
   using this shortcode: [adinserter block=”1″]. But it seems that it is not working
   correctly.
 * What can we do to make it work?
 * Thanks

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

 *  Plugin Author [Verdant Studio](https://wordpress.org/support/users/verdantstudio/)
 * (@verdantstudio)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18142505)
 * Hi [@tbalcie](https://wordpress.org/support/users/tbalcie/), thank you for reaching
   out.
   Could you provide more details about the issue you’re experiencing? I’ve
   installed the Ad Inserter plugin and can confirm that the shortcode is being 
   converted to output. However, I’m currently testing without a real ad.
 * Please note that the calendar’s content is dynamically loaded on request. If 
   your code relies on events like `DOMContentLoaded`, it may not trigger as expected
   because the page has already finished loading by the time the calendar content
   appears.
 *  Thread Starter [tbalcie](https://wordpress.org/support/users/tbalcie/)
 * (@tbalcie)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18142802)
 * Hello,
 * you can see it on this page: [https://geocachen.be/hebbes-woodie/](https://geocachen.be/hebbes-woodie/)
 * If you open the first day (Dag 1), then you see that the ad isn’t loaded, but
   you can see a part of the code. What can I do about that?
 *  Plugin Author [Verdant Studio](https://wordpress.org/support/users/verdantstudio/)
 * (@verdantstudio)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18143463)
 * Currently, the content behind every door is loaded on request to verify if someone
   is allowed to access a specific day. This is to prevent people from peaking at
   the page source to see the rewards.
   In your code you have the script tag loading
   the `adsbygoogle.js` file, but it won’t be initialised because the page has already
   finished loading before the content is there. So what you could do is:Is add 
   the following to your functions.php:
 *     ```wp-block-code
       function add_google_adsense(){    ?>    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <script>        const days = document.querySelectorAll('.superac-day');        days.forEach(el => el.addEventListener('click', event => {            setTimeout(function() {                return (adsbygoogle = window.adsbygoogle || []).push({});            }, 1000);        }));    </script>    <?php}add_action( 'wp_footer', 'add_google_adsense' );
       ```
   
 * You would then only keep the HTML part `<ins ...></ins>` inside Adinserter.
   I’ll
   see if this is something I can improve on in a future version of the plugin.
    -  This reply was modified 1 year, 6 months ago by [Verdant Studio](https://wordpress.org/support/users/verdantstudio/).
 *  Thread Starter [tbalcie](https://wordpress.org/support/users/tbalcie/)
 * (@tbalcie)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18144281)
 * Hi,
 * I added the code to the functions.php. It looks like it is working, but why is
   a bit of the adsense code displayed? Normally you should only see an ad, know
   this code is also triggered/displayed:
 * _style=”display:block”
   data-ad-client=”ca-pub-xxxxxxxxxxxxx”data-ad-slot=”xxxxxxxxxxxx”
   data-ad-format=”auto”data-full-width-responsive=”true”>
 *  Plugin Author [Verdant Studio](https://wordpress.org/support/users/verdantstudio/)
 * (@verdantstudio)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18144288)
 * From what I can tell the AdInserter still contains the <script> tags, you should
   only leave the <ins>…</ins> tags there. Because you are now loading the script
   tags via your functions.php.
 *  Thread Starter [tbalcie](https://wordpress.org/support/users/tbalcie/)
 * (@tbalcie)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18144537)
 * Still the same if I delete the <script> tags
 * Only the ins tags are left.
 *  Plugin Author [Verdant Studio](https://wordpress.org/support/users/verdantstudio/)
 * (@verdantstudio)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18145091)
 * Seems the output is still coming from the AdInserter. Perhaps try:
   1. Resave 
   the page with the calendar (it shouldn’t matter but for testing purposes)2. Check
   any caching plugins3. Double check if really saved the AdInserter and the output
   is really not there anymore, maybe add different text to make sureIf it is still
   not working, please reach out via the contact form and send me a screenshot of
   the Adinserters content.

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

The topic ‘Using AdInserter Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/super-advent-calendar/assets/icon-256x256.png?rev=3481090)
 * [Super Advent Calendar](https://wordpress.org/plugins/super-advent-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/super-advent-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/super-advent-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/super-advent-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/super-advent-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/super-advent-calendar/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Verdant Studio](https://wordpress.org/support/users/verdantstudio/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/using-adinserter-shortcode/#post-18145091)
 * Status: resolved