Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Wordpress code (https://www.warriorforum.com/programming/1289892-wordpress-code.html)

conchmarketing 27th July 2017 11:00 AM

Wordpress code
 
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?

tampawebseo 27th July 2017 03:56 PM

RE: wordpress code
 
https://codex.wordpress.org/Conditional_Tags

it's a long read but it works miracles

evoluer 29th July 2017 06:58 AM

RE: Wordpress code
 
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');
} ?>

techugo 31st July 2017 03:24 AM

RE: Wordpress code
 
we can use this code...


All times are GMT -6. The time now is 12:02 PM.