Add a Banner for every 4 posts in my Home
-
WordPress Hello friends, I have a little problem, I’m working staff has the ability to issue options to place a notice of Google Code for every 2 Post on my homepage, excellent if you use any advertising program like Google AdWords, trouble is that I want to put my own banner ad, and the problem I have is that it repeats the same banner every other post, and so does not help me, I want each banner is different. Homepage appears 20 post and if I divide every 3 post a notice would go out six banner on my home page with a width of 550×140 high, super well but I could not, accomplish do that.
here is the code in different files:
First create that where:
option-functions.php
array( "name" => __("Google Adsense en entrada Individual", TEMPLATE_DOMAIN), "description" => __("Insertar el código de Google Adsense para su entrada individual. Aparecerá antes <em>post_content()</em>. Dejar en blanco si no se utiliza.", TEMPLATE_DOMAIN), "id" => $shortname."_adsense_single", "type" => "textarea", "default" => ""),
template-blog.php in which is inserted:
<div class="separator"></div> <?php $get_google_code = get_theme_option('adsense_post'); if($get_google_code == '') { ?> <?php } else { ?> <?php if(( 2 == $postcount) || (4 == $postcount) ){ ?> <div class="adsense-post"> <?php echo stripcslashes($get_google_code); ?> </div> <div class="separator"></div> <?php } ?> <?php } ?> <?php ($oddpost == "alt-post") ? $oddpost="" : $oddpost="alt-post"; $postcount++; ?> <?php endwhile; ?>
And this home.php where appear the following code:
<div class="separator"></div> <code><?php $get_google_code = get_theme_option('adsense_post');</code>if($get_google_code == '') { ?> <?php } else { ?> <?php if(( 2 == $postcount) || (4 == $postcount) ){ ?> <div class="adsense-post"> <?php echo stripcslashes($get_google_code); ?> </div> <div class="separator"></div> <?php } ?> <?php } ?> <?php ($oddpost == "alt-post") ? $oddpost="" : $oddpost="alt-post"; $postcount++; ?> <?php endwhile; ?>
How I can change this to display different ad every 3 post.
Try creating several thing and anything that makes me the required effect.
Thank you very much for your input ..
- The topic ‘Add a Banner for every 4 posts in my Home’ is closed to new replies.