Jump to content

Wordpress 3.1 and ClassiPress 3.0.5.3


ahmed_one

Recommended Posts

Hi to All,

 

This is my first post in hoping to get more help then expected. I am using Wordpress and famous theme Classipress 3.0.5.3. I need some code to display adsense code in main listings of my classipress main page. It should display adsense ads after every user posts ads in main classipress page. I've tried to modify loop-ad.php as follows (In red adsense code):

 

<?php
/**
* Main loop for displaying ads
*
* @package ClassiPress
* @author AppThemes
*
*/
?>

<?php if(have_posts()) : ?>

    <?php while(have_posts()) : the_post(); ?>
      <div class="post-block">
		<div class="ad-left">

			<?php if(get_option('cp_ad_images') == 'yes') cp_ad_loop_thumbnail(); ?>

		</div>

            <div class="<?php if(get_option('cp_ad_images') == 'yes') echo 'ad-right'; else echo 'ad-right-no-img'; ?> <?php echo get_option('cp_ad_right_class'); ?>">

                <h3><a href="<?php the_permalink(); ?>"><?php if (mb_strlen(get_the_title()) >= 75) echo mb_substr(get_the_title(), 0, 75).'...'; else the_title(); ?></a></h3>

			<div class="price-wrap">
				<span class="tag-head"> </span><p class="ad-price"><?php if(get_post_meta($post->ID, 'price', true)) cp_get_price_legacy($post->ID); else cp_get_price($post->ID); ?></p>
			</div>

			<div class="clr"></div>

                <p class="ad-meta">
				<span class="folder"><?php if (get_the_category()) the_category(', '); else echo get_the_term_list($post->ID, 'ad_cat', '', ', ', ''); ?></span> | <span class="owner"><?php if (get_option('cp_ad_gravatar_thumb') == 'yes') appthemes_get_profile_pic(get_the_author_meta('ID'), get_the_author_meta('user_email'), 16) ?><?php the_author_posts_link(); ?></span> | <span class="clock"><span><?php echo appthemes_date_posted($post->post_date); ?></span></span></p>

			<p class="ad-desc"><?php $tcontent = strip_tags(get_the_content()); if (mb_strlen($tcontent) >= 165) echo mb_substr($tcontent, 0, 165).'...'; else echo $tcontent; ?>
</p>
			<p class="stats"><?php if (get_option('cp_ad_stats_all') == 'yes') appthemes_get_stats($post->ID); ?></p>

[color=red][b]<script type="text/javascript"><!--
google_ad_client = "pub-0837475424405536";
/* 468x60, created 24/03/11 */
google_ad_slot = "6135039912";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
		[/b][/color]
                <div class="clr"></div>

            </div>

            <div class="clr"></div>

      </div><!-- /post-block -->


    <?php endwhile; ?>

    <?php if(function_exists('appthemes_pagination')) appthemes_pagination(); ?>

<?php else: ?>

    <div class="shadowblock_out">

	<div class="shadowblock">

		<div class="pad10"></div>

		<p><?php _e('Sorry, no listings were found.','appthemes')?></p>

		<div class="pad50"></div>
        
	</div><!-- /shadowblock -->

</div><!-- /shadowblock_out -->

<?php endif; ?>

<?php wp_reset_query(); ?>

 

But it shows adsense ads only first 2 posts and not to all posts submitted by users.

 

I need correct code which shows adsense ads after every user posts.

 

thanks

 

regards

Ahmed

Link to comment
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.