<div class="tabcontrol">
<ul class="tabnavig">[*]<span class="big"><?php _e('Just Listed','cp')?></span>[*]<span class="big"><?php _e('Most Popular','cp')?></span>[*]<span class="big"><?php _e('Random','cp')?></span>[/list]
<div class="tabcontrol">
<div id="block2">
<div class="clr"></div>
<div class="undertab"><span class="big"><?php _e('Classified Ads','cp') ?> / <span class="colour"><?php _e('Most Popular','cp') ?></span></span></div>
<?php
// give us the most popular ads based on page views
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "cp_ad_pop_total a "
. "INNER JOIN " . $wpdb->posts . " p ON p.ID = a.postnum "
. "WHERE postcount > 0 AND post_status = 'publish' "
. "ORDER BY postcount DESC LIMIT 10");
$pageposts = $wpdb->get_results($sql);
?>
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>
<?php // if(is_sticky()) continue; // don't show any sticky posts in the main section ?>
<?php if (in_category(CP_BLOG_CAT_ID) || cp_post_in_desc_cat(CP_BLOG_CAT_ID)) continue; // don't show any blog posts ?>
<div class="whiteblock can_chg_bg">
<?php if(get_post_meta($post->ID, 'images', true)) cp_single_image_legacy($post->ID, get_option('medium_size_w'), get_option('medium_size_h')); else cp_get_image($post->ID, 'medium', 1); ?>
<div class="priceblockbig">
<h3><?php if (strlen(get_the_title()) >= 45) echo substr(get_the_title(), 0, 45).'...'; else the_title(); ?></h3>
<p class="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="bot4px dotted"><?php _e('Category','cp') ?>: <?php the_category(', ') ?> | <?php _e('Listed','cp') ?>: <?php echo cp_ad_posted($post->post_date); ?></p>
<p class="descr"><?php echo substr(strip_tags($post->post_content), 0, 200)."...";?></p>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endforeach; ?>
<?php // if(function_exists('cp_pagination')) cp_pagination(); ?>
<?php else: ?>
<div class="whiteblock can_chg_bg">
<h3><?php _e('Sorry, no listings were found.','cp')?></h3>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<div id="block3">
<div class="clr"></div>
<div class="undertab"><span class="big"><?php _e('Classified Ads','cp') ?> / <span class="colour"><?php _e('Random','cp') ?></span></span></div>
<?php
// show all random ads but make sure the sticky featured ads don't show up first
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('caller_get_posts' => 1, 'paged' => $paged, 'orderby' => rand,'category__not_in' => cp_get_blog_cat_ids_array(),);
?>
<?php query_posts($args); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php // if(is_sticky()) continue; // don't show any sticky posts in the main section?>
<?php // if (in_category(CP_BLOG_CAT_ID) || cp_post_in_desc_cat(CP_BLOG_CAT_ID)) continue; // don't show any blog posts ?>
<div class="whiteblock can_chg_bg">
<?php if(get_post_meta($post->ID, 'images', true)) cp_single_image_legacy($post->ID, get_option('medium_size_w'), get_option('medium_size_h')); else cp_get_image($post->ID, 'medium', 1); ?>
<div class="priceblockbig">
<h3><?php if (strlen(get_the_title()) >= 45) echo substr(get_the_title(), 0, 45).'...'; else the_title(); ?></h3>
<p class="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="bot4px dotted"><?php _e('Category','cp') ?>: <?php the_category(', ') ?> | <?php _e('Listed','cp') ?>: <?php echo cp_ad_posted($post->post_date); ?></p>
<p class="descr"><?php echo substr(strip_tags($post->post_content), 0, 200)."...";?></p>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endwhile; ?>
<?php if(function_exists('cp_pagination')) cp_pagination(); ?>
<?php else: ?>
<div class="whiteblock can_chg_bg">
<h3><?php _e('Sorry, no listings were found.','cp')?></h3>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<?php
// show all ads but make sure the sticky featured ads don't show up first
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('caller_get_posts' => 1, 'paged' => $paged,'category__not_in' => cp_get_blog_cat_ids_array(),);
?>
<?php query_posts($args); ?>
<?php
// show all ads but make sure the sticky featured ads don't show up first
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('caller_get_posts' => 1, 'paged' => $paged,'category__not_in' => cp_get_blog_cat_ids_array(),);
?>
<?php query_posts($args); ?>
<?php if ( is_home('') ) {
// START STICKIES ONLY ON INDEX - FOR FRONTPAGE FEATURED ADS
$args = array(
'posts_per_page' => 25,
'post__in' => get_option('sticky_posts'),
'caller_get_posts' => 1
//'paged'=>$paged,
);
query_posts($args);
// END STICKIES ON INDEX
}
?>
There are currently 1 users browsing this thread. (0 members and 1 guests)