Jump to content


This topic is now archived and is closed to further replies.


Wordpress 3.1 and ClassiPress

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 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):


* 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 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 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 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 type="text/javascript"
                <div class="clr"></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.






Share this post

Link to post
Share on other sites

  • 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.