Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 27th Jul 2017, 11:00 AM   #1
Warrior Member
 
Join Date: 2016
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Wordpress code
Share on: 
fb share twitter share gplus share more share

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?
conchmarketing is offline  
Unread 27th Jul 2017, 03:56 PM   #2
Wordpress Fanatic
 
tampawebseo's Avatar
 
Join Date: 2009
Location: Boston, Ma
Posts: 6
Thanks: 0
Thanked 2 Times in 2 Posts
Default
RE: wordpress code
Share on: 
fb share twitter share gplus share more share

https://codex.wordpress.org/Conditional_Tags

it's a long read but it works miracles

tampawebseo is offline  
Unread 29th Jul 2017, 06:58 AM   #3
Warrior Member
 
Join Date: 2017
Location: Coimbatore, India
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default
RE: Wordpress code
Share on: 
fb share twitter share gplus share more share

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');
} ?>
evoluer is offline  
Unread 31st Jul 2017, 03:24 AM   #4
Active Warrior
 
techugo's Avatar
 
Join Date: 2016
Location: USA
Posts: 41
Thanks: 3
Thanked 8 Times in 8 Posts
Default
RE: Wordpress code
Share on: 
fb share twitter share gplus share more share

we can use this code...

techugo is offline  
Closed Thread


Bookmarks

Tags
code, wordpress


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 11:28 AM.