Hey Guys , I am using the default post template (single.php).
I’d like to have a Google Responsive ad ( I am using Custom Ad 1 for it) Below the header but above the content , and by content I mean both the post (loopsingle) and the side bar..
I tried playing with the single.php but failed , can you please guide/ tell me where I need to make the change to get a centred Ad above the (post + sidebar) …
As a suggestion , you could potentially have that as a header style ..
Cheers
Hi,
Header style 3 comes with an ad bellow the menu and above the content. But that’s the header ad, if you want to add a custom one you have to edit the template files.
In your case try to add it inside single.php like this: – http://screencast.com/t/7cX1Dh7b9
echo td_page_generator::wrap_start();
echo td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'custom_ad_1'));
echo td_page_generator::wrap_end();
Thank you, Emil G.
-
This reply was modified 11 years by
Emil G.
Thanks Emil , That worked..
Is it possible to edit the title of this thread ( & correct my two typos) so others could find it more easily ?
Hello guys, i used this code and put it exactly where you specified. On line 66-68 but i got this error
Fatal error: Call to undefined method td_page_generator::wrap_start() in /home/claekw/viralnotes.net/files/themes/ViralNotes/single.php on line 66
what do i do next? i would like to add custom ad 1 to the location linear whiz talked about and i will like to add custom ad 2 below article under the share button…before the “previous article” and “next article”..its not going to be an adsense ads, but a special ads from a content company where they display articles from their site on my site.
Hi,
Did you renamed the theme folder? on your error i see it’s called ViralNotes, make sure you use Newspaper.
If it’s not the case please provide the whole code from your single.php so i can take a look, use pastebin – http://pastebin.com/
Thank you, Emil G.
Hi, i used a plugin to hide all details that i’m using wordpress. so it probably changed the name of the theme.
here is my single.php: http://pastebin.com/q01tTyXv
here is the code i want to add to the bottom of my article:
<div id=”taboola-below-article-thumbnails”></div>
<script type=”text/javascript”>
window._taboola = window._taboola || [];
_taboola.push({
mode: ‘thumbnails-a’,
container: ‘taboola-below-article-thumbnails’,
placement: ‘Below Article Thumbnails’,
target_type: ‘mix’
});
</script>
i can add that code to custom 1 and call it or i could use the put the code directly in my single.php. i rather paste the code 🙂
This is a screenshot of where i want the code to be placed: http://s15.postimg.org/wbclfiyij/below.jpg
Hi,
If this is a plugin you have to look into the plugin documentation to see how you can integrate it. Usually the script goes in the header or footer and the div in the template(after next/prev post you have to edit loop-single): http://screencast.com/t/dfhvceeV
Thanks!
hi,
no this is not a plugin.. it is an ads code. i showed you the code and where i would like to place it with the screenshot above..
how can i find what post template i use? i put it in loop-single.php but it won’t show so i’m thinking maybe i am using another post template
Hi,
If you add the code in loop-single.php you have to set from Post Setting the default post template: http://screencast.com/t/3cUEtTkaY
You can try to add all code there but I’m not sure if it will work.
Thanks!
hi it works for some code but others don’t work. I am contacting taboola team to see if the problem is from their end of your theme. How do you call custom ads 1 in when in editor? i want to place custom ad 1 directly in the editor because i want it to display only on desktop..
Hi,
Please take a look here: https://forum.tagdiv.com/topic/google-adsense-2/#post-41268
Also our documentation maybe will help: https://forum.tagdiv.com/ads/
Thanks!
hi, i tried this;
echo td_page_generator::wrap_start();
echo td_global_blocks::get_instance(‘td_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_1’));
echo td_page_generator::wrap_end();
on line 66 just like http://screencast.com/t/7cX1Dh7b9 on single.php
but that gives me a fatal error “Call to undefined method td_page_generator::wrap_start() in xxxx/xxx/x/xx//xxx/x/single.php on line 66”
i put in “xx” to hide my information. Here is my single.php file; can you help me display custom ad 1 to above posts+content below menu. Thanks
Hi,
If you want to place the ad in the post template please use the do_shortcode() function: http://screencast.com/t/aC3Y1kmdkht
<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]'); ?>
Result: http://screencast.com/t/dAz3dCV4v
Also please post your issues in newsmag section – https://forum.tagdiv.com/forum/newsmag/
-
This reply was modified 11 years by
Alin [tagDiv].
Hi, I would like to achieve the same as linearwhiz, but a look at Single.php I realized the code has changed since then. I am using the latest version of the theme. Where can I place the code?
Thank you.
Hello,
Since this topic, the code has changed a bit. You will have to use a do_shortcode function inside the template files corresponding to each of the post styles that you use.
Hi
– add the ad code in one of theme’s custom ad spots
– create a new page and add an ad-block on it, select in ad-block the custom ad-spot which hold ad’s code: http://screencast.com/t/T9QrVpFshiG
– press the CLASSIC MODE button and copy the shortcode: http://screencast.com/t/09LWoaPqeUA
– edit the file corresponding with the post stylkes that you use and add this line of code:
<?php echo do_shortcode('[vc_row][vc_column][td_block_ad_box spot_id="custom_ad_1"][/vc_column][/vc_row]');?>
In above example I’ve used custom ad 1 but you can use any custom ad spot from theme panel.
Thanks!