Jump to content

Recommended Posts

Hi, i have a wordpress site http://shippingandfreightresource.com.. There is an adsense ad in the body of the site (not the header or sidebar).. I would like to know how to position this ad ABOVE the hr tag between the "Continue Reading" and "Leave a Comment".. Right now it is showing BELOW the hr tag.. 

 

I have below code in the index.php file..

 

Any help would be appreciated.. Thanks.. 

 

<?php
/**
 * The main template file.
 *
 * @package Fresh & Clean
 */
 
get_header(); ?>
 
<div id="content" role="main">
 
<?php if ( is_archive() ) : ?>
<header class="archive-header">
<h1 class="archive-title">
<?php if ( is_day() ) : ?>
<?php printf( __( 'Posted on %s …', 'fresh-and-clean' ), '<span>' . get_the_date() . '</span>' ); ?>
<?php elseif ( is_month() ) : ?>
<?php printf( __( 'Posted in %s …', 'fresh-and-clean' ), '<span>' . get_the_date( 'F Y' ) . '</span>' ); ?>
<?php elseif ( is_year() ) : ?>
<?php printf( __( 'Posted in %s …', 'fresh-and-clean' ), '<span>' . get_the_date( 'Y' ) . '</span>' ); ?>
<?php elseif( is_author() ) : ?>
<?php printf( __( 'Posted by %s …', 'fresh-and-clean' ), '<span>' . get_the_author() . '</span>' ); ?>
<?php elseif ( is_category() ) : ?>
<?php printf( __( 'Filed under %s …', 'fresh-and-clean' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?>
<?php elseif ( is_tag() ) : ?>
<?php printf( __( 'Tagged with %s …', 'fresh-and-clean' ), '<span>' . single_tag_title( '', false ) . '</span>' ); ?>
<?php endif; ?>
</h1>
</header><!-- .archive-header -->
<?php endif; ?>
<?php if ( is_search() ) : ?>
<header class="archive-header">
<h1 class="archive-title">
<?php printf( __( 'Matches for: “%s” …', 'fresh-and-clean' ), '<span>' . get_search_query() . '</span>' ); ?>
</h1>
</header><!-- .archive-header -->
<?php endif; ?>
 
 
<?php if ( have_posts() ) : ?>
<?php $count = 1; ?> <?php while ( have_posts() ) : the_post(); /* Start the Loop */ 
 
 
 
// We want to exclude posts that are prominently shown as featured
if ( is_sticky() && has_post_thumbnail() && is_home() ) 
 
{
// Let's check the image.
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large-feature' );
// If it is bigger or equal to featured width, let's skip this post
if ( $image[1] >= FEATURED_IMAGE_WIDTH )
continue;
 
}
 
/* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>
<?php if ($count == 1) : ?>
 
<!-- begin #ads -->
<div id="safresbodyad">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5961853191380961";
/* Safresbodyad */
google_ad_slot = "3166590038";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
</script>
</div>
<!-- end #ads --> 
<hr>
<?php endif; $count++; ?>
 
<?php endwhile; ?>
 
<?php fresh_and_clean_content_nav( 'nav-below' ); ?>
 
<?php else : ?>
 
<article id="post-0" class="hentry error404">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'fresh-and-clean' ); ?></h1>
</header><!-- .entry-header -->
 
<div class="entry-content">
<p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'fresh-and-clean' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
 
</article><!-- #post-0 -->
 
<?php endif; ?>
 
</div><!-- #content -->
 
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Link to comment
https://forums.phpfreaks.com/topic/281761-issue-with-placing-adsense-ads/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.