• Hello:

    I need to use this plugin in a multi publisher website that display googe ads the belong to each authors.

    I have a plugin that handel the share ratio and every thing and i have a shortcode on that plugin that display the author publisher id and ads slot on his post using the following short code.

    <?php
     function adsense_id_func(  ) {
    	global $flag;
        return $flag;
      }
      add_shortcode( 'adsense_id', 'adsense_id_func' );
    ?>
    <?php
     function adsense_id_slot_func(  ) {
    	global $adslot;
        return $adslot;
      }
      add_shortcode( 'adsense_id_slot', 'adsense_id_slot_func' );
    ?>
    

    I try to put the shortcode [adsense_id_slot] and [adsense_id] in your plugin backend but it can not render.

    How to make that shortcode work on your plugin to add the author google ads info automatically on the ads acording to the share ratio i have?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The shortcode must be place in the plain html option. Usually shortcodes are working there perfectly. If shortcodes are not shown there, either the shortcode is broken or it needs a specific load priority. Lowering or increasing the load priority could do the job.

    You should also test if the shortcode is working in regular posts.

    In your case: If the code is not shown it means, the global $adslot or $flag is not populated at all (at the order where the code is executed) and the corresponding code which is creating these globals should be checked first.

    Btw. these globals are dangerous. Not only because they are global but they have a very general name which could easily be redeclared by another plugin. This will lead into conflicts than.

    Thread Starter Medow

    (@medow)

    Thanks for reply ,,

    Using plan html code is working partilly here is the code in html ads code:

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Traidnt Header Responsive -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client = "[adsense_id]"
         data-ad-slot ="[adsense_id_slot]"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script>
      (adsbygoogle = window.adsbygoogle || []).push({
        google_ad_client: "[adsense_id]",
        enable_page_level_ads: true
      });
    </script>

    Here is the output:

    <!-- WP QUADS Content Ad Plugin v. 1.6.1 -->
    <div class="quads-location quads-ad1" id="quads-ad1" style="float:none;margin:0px;">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Traidnt Header Responsive -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client = "[adsense_id]"
         data-ad-slot ="[adsense_id_slot]"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script>
      (adsbygoogle = window.adsbygoogle || []).push({
        google_ad_client: "ca-pub-2994539583798950",
        enable_page_level_ads: true
      });
    </script>
    </div>

    As you can see the second part of the code render perfect but the first part that has the <ins class="adsbygoogle" is not rendering the shortcode .

    How to bypass this issue in the <ins class ?

    Thanks.

    If you put shortcode [adsense_id] diretcly into any post is it returning value or still not rendered?

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

The topic ‘How to insert value from other plugin?’ is closed to new replies.