| | #1 |
| Warrior Member Join Date: 2016
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
i am trying to alter some code on my site. I have an ad tag like this: <section style="text-align:center;"> <?php if (isset($page) && $page > 2) { get_adblock('above-content-ad1'); } ?> </section> It will show the ad tag (above-content-ad1) for all pages greater than page 2. I want to edit the code to show the ad tag on just odd (or even) numbered pages. Can someone please help me alter this code to reflect this? |
| |
| | #2 |
| Wordpress Fanatic Join Date: 2009 Location: Boston, Ma
Posts: 6
Thanks: 0
Thanked 2 Times in 2 Posts
| |
| | |
| |
| | #3 |
| Warrior Member Join Date: 2017 Location: Coimbatore, India
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
Try <?php if (isset($page) && ($page % 2==0)) {//even pages get_adblock('above-content-ad1'); <?php if (isset($page) && ($page % 2!=0)) {//odd pages get_adblock('above-content-ad1'); } ?> |
| |
| | #4 |
| Active Warrior Join Date: 2016 Location: USA
Posts: 41
Thanks: 3
Thanked 8 Times in 8 Posts
|
we can use this code...
|
| | |
| |
|
| Bookmarks |
| Tags |
| code, wordpress |
| |