Hello, I would like to add a specific ad being called from custom 1 on the category and tag pages. Basically I would like the same setup like the home page (http://www.sneakerfiles.com/oncourt/) with the ad showing up after the third and fourth blog posts: http://www.sneakerfiles.com/oncourt/category/nba-highlights/
I tried to search and found something, but noticed that it actually shows the code that I paste in, rather than displaying the ad.
Hi,
You have to edit loop.php file like this: http://screencast.com/t/kXKRxx26
$adcounter = 0;
$adcounter++;
if (is_category() or is_tag()) {
if ($adcounter == 2 or $adcounter == 4) {
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');
}
}
Result: http://screencast.com/t/Grz40A7iV3
Thanks!
-
This reply was modified 11 years by
Alin [tagDiv].
Hi,
What if i want to add some comdition for this,
if the page is “home” don’t show the ads
so the ads only shows on all categories pages, but not the home page.
is there a variable to recognize the page is “home” page or else ?
Thx
-
This reply was modified 10 years by
am1rnet.
Hi
You can some of WordPress’s built in functions such as is_home() if you’re using blog template or is_front_page() if you’re using a static page. For more detail about those functions and how to use them check these links: https://codex.wordpress.org/Function_Reference/is_front_page – https://codex.wordpress.org/Function_Reference/is_home
Thanks!
Hi orcn,
In the latest version of the theme was changed the root theme files and added in the td-composer folder. If you want to edit the loop.php, now, you will find it here -> https://www.screencast.com/t/PhhE1ke0NzP
Thank you!