function cp_get_content_preview() {
return apply_filters( 'cp_get_content_preview', get_the_excerpt(), 55 );
}
function cp_output_random_ads_listing() {
global $wp_query;
remove_action( 'appthemes_after_endwhile', 'cp_do_pagination' );
$post_type_url = add_query_arg( array( 'paged' => 2 ), get_post_type_archive_link( APP_POST_TYPE ) );
// 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;
query_posts( array( 'post_type' => APP_POST_TYPE, 'ignore_sticky_posts' => 1, 'post_status' => 'publish', 'paged' => $paged, 'orderby' => 'rand' ) );
$total_pages = max( 1, absint( $wp_query->max_num_pages ) );
get_template_part( 'loop', 'ad_listing' );
if ( $total_pages > 1 ) {
$random_url = add_query_arg( array( 'sort' => 'random' ), $post_type_url );
cp_the_view_more_ads_link( $random_url, 'random' );
}
}
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
query_posts(
array( 'post_type' => APP_POST_TYPE,
'meta_query' => array (
array( 'key' => 'cp_category',
'value' => 'Не определено',
'compare' => '=',
'paged' => $paged
)
),
'ignore_sticky_posts' => 1
);
get_template_part( 'loop', 'ad_listing' );
wp_reset_query();
global $cp_options;
<div class="post-block-out <?php cp_display_style( 'featured' ); ?>">
<div class="post-block">
<div class="post-left">
<?php if ( $cp_options->ad_images ) cp_ad_loop_thumbnail(); ?>
</div>
<div class="<?php cp_display_style( array( 'ad_images', 'ad_class' ) ); ?>">
<?php appthemes_before_post_title(); ?>
<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="clr"></div>
<?php appthemes_after_post_title(); ?>
<div class="clr"></div>
<?php appthemes_before_post_content(); ?>
<p class="post-desc"><?php echo cp_get_content_preview(); ?></p>
<?php appthemes_after_post_content(); ?>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div><!-- /post-block -->
</div><!-- /post-block-out -->