• Resolved nikkoboy

    (@nikkoboy)


    Hi,

    First of all I wish to congratulate you for the fantastic plugin you created. I’ve been using it for more than three years now, and i’m really happy with all its features.

    I’m contacting today you because I don’t seem to be able to use your plugin’s shortcode feature or PHP function call (manual insertion) with my theme’s ad space. This ad space accepts html, and I’m able to use any kind of adcode ranging from Adsense to simple image html. however, Ad Inserter’s shortcode just features a shortcode in the header ad code space when the page has loaded, and the PHP function does not display anything.

    I read all your documentations, but nothing works. Here is an example of a webpage where I’m trying to implement your shortcode (the ad space is in the header, on the right hand side opposite to the logo): https://www.fleamarketinsiders.com/brick-lane-market/

    I also tried a workaround, by using “custom hooks”, since Ad Inserter offers this solution: https://adinserter.pro/documentation#custom-hooks

    I read the documentation in the above link, and I looked for the name that is used in the do_action () WordPress function of my theme, but I think I did not properly identify it. Is it “header-ad”? I tried this action as a custom hook, but it did not work. The ad does not appear either.

    I’d really appreciated any guidance you could provide, so I can use the ad space in the header (right hand side opposite to the logo) with Ad Inserter.

    Thanks!

    • This topic was modified 7 years, 3 months ago by nikkoboy.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Spacetime

    (@spacetime)

    Hello,

    I’m not sure whether I understand your problem correctly.

    How have you used the shortcode?
    How have you implemented PHP function call or custom hook?

    Please enable remote debugging:
    https://www.ads-software.com/support/topic/ad-inserter-support-how-to-ask-for-help/

    In the space next to the logo you have the following code:

    <div class="header-ad">	
    <!--MONUMETRIC [ATF|Pos 1] D:728x90 T:728x90 M:320x50,320x100 START-->
    
    <div id="mmt-89db5b0f-7437-45eb-a506-b9a9d42365d8"></div>
    <script type="text/javascript" data-cfasync="false">$MMT = window.$MMT || {}; $MMT.cmd = $MMT.cmd || [];$MMT.cmd.push(function(){ $MMT.display.slots.push(["89db5b0f-7437-45eb-a506-b9a9d42365d8"]); })</script>
    
    <!--MONUMETRIC [ATF|Pos 1] D:728x90 T:728x90 M:320x50,320x100  ENDS-->	
    </div>

    However, this code doesn’t show anything.

    You have a lot of javascript errors on that page:

    Thread Starter nikkoboy

    (@nikkoboy)

    Hi Igor,

    Thanks for your help! I really appreciate. Sorry if I did not manage to properly explain my problem, it was indeed a bit blurry.

    Basically, I want to make the space next to the logo, visible/accessible by Ad Inserter, and use this space for Ad Inserter ads.

    #1. How have you used the shortcode?
    I tried both [adinserter name=”myAd”] and [adinserter block=”7″]

    #2. How have you implemented PHP function call
    I used <?php if (function_exists ('adinserter')) echo adinserter (7); ?>

    #3. or custom hook?
    I went to “Ad Inserter settings” > tab “Hook” > and used “header-ad” hook in “action”.

    The code in the space next to the logo, should be replaced by one of your shortcode, PHP function call or hook, once I will have been able to implement any of those solution.

    Once again, I really appreciate your help.

    • This reply was modified 7 years, 3 months ago by nikkoboy.
    Plugin Author Spacetime

    (@spacetime)

    Are you sure header-ad hook exists in your theme?

    If not you can make it there.
    You need to modify your theme file (very likely header.php, I suggest to create a child theme and not to modify the original theme files) with something like this:

    <div class="header-ad">
    <?php do_action ('header-ad') ?>
    </div>

    Then you configure it in Ad Inserter and use it as position for automatic insertion.

    Thread Starter nikkoboy

    (@nikkoboy)

    Hi Igor,

    Thanks for your input! I had a look into the header.php file of my theme, and found a snippet which looks closely like the one your provided:

    				<?php if (wt_get_option( 'wt_header_ad' )) {?>
    					<div class="header-ad">	
    						<?php echo wt_get_option( 'wt_header_ad' ); ?>	
    					</div>
    				<?php } ?>

    Since they almost look like the same, I’m not sure if this would change anything. I’ll give it a go to see if that changes anything (but it will likely deactivate the ad space from the theme’s settings).

    FYI, I also tried and added wt_header_ad to the hook settings in Ad Inserter, but it didn’t work.

    Cheers,

    Plugin Author Spacetime

    (@spacetime)

    But there is no such hook as wt_header_ad in your file?!

    In my post above you have the code for the hook if you wish to implement it.

    Thread Starter nikkoboy

    (@nikkoboy)

    Hi Igor,

    I replaced

    <?php if (wt_get_option( 'wt_header_ad' )) {?>
    <div class="header-ad">	
    <?php echo wt_get_option( 'wt_header_ad' ); ?>	
    </div>
    <?php } ?>

    By your code

    <div class="header-ad">
    <?php do_action ('header-ad'); ?>
    </div>

    And it worked! The ad space is now available in Ad Inserter.

    I think the issue was that the hook does work with do_action and not with wt_get_option.

    Thanks again for your assistance!

    • This reply was modified 7 years, 3 months ago by nikkoboy.
    Plugin Author Spacetime

    (@spacetime)

    I think the issue was that the hook does work with do_action and not with wt_get_option.

    Of course!

    Thanks again for your assistance!

    Please say it here:
    https://www.ads-software.com/support/plugin/ad-inserter/reviews/

    Thread Starter nikkoboy

    (@nikkoboy)

    Thanks Igor! I’m rating your plugin 5 stars!! Awesome assistance, and fantastic plugin!!

    Plugin Author Spacetime

    (@spacetime)

    ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Manual insertion: Shortcode or PHP function call not working’ is closed to new replies.