jockpost
Member
Posted 1 year ago #
I have a customer who would like to display an ad on the following page:
http://jockpost.com/category/nba/page/13/
How can I tell WordPress (preferably using PHP code, not a plugin) to display the ad code only on that exact URL/page, in that category?
Thanks in advance for your help!
<?php if (is_page('13') && in_category('nba')) {?>
Insert your code...
<?php }?>
jockpost
Member
Posted 1 year ago #
Sorry, but the code above didn't work for me.
I'm very close...
The following code below is almost working. The problem is I can't seem to get it to be the exact page.
<?php if ( $paged > 12 && is_category('nba')) { ?>
<p>Test</p>
<?php } ?>
This shows the code on all pages above Page 12. If I change the greater-than symbol to an equals sign, it stops working. How can I have it show up on one specific page in an archive (category)?
jockpost
Member
Posted 1 year ago #
Believe it or not, this worked:
<?php if ( $paged > 12 && is_category('nba') && $paged < 14 ) { ?>
Text
<?php } ?>
Seems a little hokey to me...
More than 12 and less than 14, lol, why not just check if it's a value of 13?
<?php if( 13 == $paged && is_category('nba') ) : ?>
Text
<?php endif; ?>
gazouteast
Member
Posted 1 year ago #
LOL Mark beat me to it, but I wanted to keep the "hokey-ness" and bracket the options
<?php if((( 13 == $paged || ($paged == 13 )) && (is_category('nba'))): ?>
Text
<?php endif; ?>
;)