konetch Posted May 7, 2009 Share Posted May 7, 2009 I want to display an ad in the middle of the content on my page. The code is <?php get_header(); ?> <?php get_sidebar(); ?> <div class="middle"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2> <p class="postmetadata"><small><?php the_time('F jS, Y') ?> <?php // the_author() ?></small></p> <!-- google_ad_section_start --> <script type="text/javascript"><!-- google_ad_client = "pub-8608882512429839"; /* 468x60, created 11/22/08 */ google_ad_slot = "9755555134"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <div> <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <div style="margin-bottom:15px;"> <script type="text/javascript"><!-- google_ad_client = "pub-8608882512429839"; /* 468x60, created 5/6/09 */ google_ad_slot = "5386821148"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <!-- google_ad_section_end --> </div> <!-- <p> <small> <span> You can follow any responses to this entry through the</span> <?php comments_rss_link('RSS 2.0'); ?> <span>feed.</span> <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Both Comments and Pings are open ?> <span>You can </span><a href="#respond">leave a response</a>, <span>or</span> <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> <span>from your own site.</span> <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Only Pings are Open ?> Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site. <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { // Comments are open, Pings are not ?> You can skip to the end and leave a response. Pinging is currently not allowed. <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { // Neither Comments, nor Pings are open ?> Both comments and pings are currently closed. <?php } edit_post_link('Edit this entry.','',''); ?> </span></small> </p> //--> </div> </div> <?php //comments_template(); ?> <div class="alignleft"><?php previous_post_link('« %link') ?></div> <div class="alignright"><?php next_post_link('%link »') ?></div> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> How would I display a google ad in the middle of the post? Thanks Alex Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.