I need add ads horizontal per category. how do it?
Thanks
Hi,
Unfortunately the theme doesn’t have an option to place ads on category page, you will need to edit loop.php file and add it manually using do_shortcode() function, like this – http://screencast.com/t/o4OtAI3IJ
$adcounter = 0;
$adcounter++;
if (is_category()) {
if ($adcounter == 2 or $adcounter == 4) {
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');
}
}
Result: http://screencast.com/t/fOlOSl9j1
If you want additional customizations and you don’t know how to do it, I suggest to get someone to help you as we cannot provide any type of custom work at this time, sorry!
Thanks!
-
This reply was modified 11 years by
Alin [tagDiv].
Thank you so much
if i want to insert in a category specify, ¿where i have to change the code? ¿and under an entry?
Thanks for your help
Hi,
Use the category id to apply this only on specific category – https://codex.wordpress.org/Function_Reference/is_category Take the category id from here – http://screencast.com/t/dulMbroS2
Thanks!
alin, How i can insert in a article of category specify?
Thanks
Hi,
Not sure what you mean, please provide more details.
Do you want to place a custom add to appear on specific post?
Thanks!
Could i ask a quick question regarding the code below?
$adcounter = 0;
$adcounter++;
if (is_category()) {
if ($adcounter == 2 or $adcounter == 4) {
echo do_shortcode(‘[td_block_ad_box spot_id="custom_ad_1"]‘);
}
}
What amends would i need to make to this code so that i can have a ‘custom_ad_1’ space after the second post and a ‘custom_ad_2’ space after the forth post. So basically 2 different ad spaces (displaying different ads) on the category page?
Thanks
Hi,
You can add the code like this – http://screencast.com/t/W7VY918Dr3Pw
$adcounter++;
if (is_category()) {
if ($adcounter == 2) {
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');
}
elseif($adcounter == 4){
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_2"]');
}
}
Thanks!
Hi,
i’m having a problem with this. I get the following error…
Parse error: syntax error, unexpected ‘{‘ in /xxx/xxx/xxx/xxx/wp-content/themes/Newspaper/loop.php on line 46
I hope you can advise
Hi,
sorry i have this working now, thanks for all your help
Hi Alin,
I want insert an ads to appear in all the articles in a particular category
Thanks
-
This reply was modified 10 years by
ingenierojas.
Hi,
Do you want to add a custom ad on your post template to appear only on articles from specific category?
For example you can try something like this: http://screencast.com/t/bCu0neub This custom ad will be displayed only if the article is apart of new-look-2015 category in my example(please use the slug name in the code).
<?php if (in_category('category slug name')){
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');
}?>
Or do you want articles ads to be displayed only on posts from specific category, please check this topic as reference – https://forum.tagdiv.com/topic/replace-adsense-code-of-ads-fields-in-a-category/ You will have to do the same just use in_category instead of !in_category.
Please note that the theme doesn’t have an option for this and I provide some example, so if you don’t have basic php experience I suggest to hire a freelancer to do this for you.
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
Hello Alin,
I did what you explain here and it works fine!
Now, i need to do the same in the articles pages, counting paragraphs … can you help me please?
For example, i want to show “custom_ad_1” below the pharagraph 1 and “custom_ad_2” below the pharagraph 2.
Thanks!
Hello,
For posts, this will be a bit trickier to code in, but you can use the main article inline ad from the theme panel: http://screencast.com/t/CrIUQRiq and you can insert custom ads inside the content when editing a post like so: http://screencast.com/t/MCVy4miUsBR
The post content is dynamic so it will be much more difficult to add another inline ad to apply to all posts.
Thank you!
