示例#1
0
						<div class="clr"></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;
query_posts(array('post_type' => APP_POST_TYPE, 'ignore_sticky_posts' => 1, 'paged' => $paged));
$total_pages = max(1, absint($wp_query->max_num_pages));
?>

						<?php 
get_template_part('loop', 'ad_listing');
?>

						<?php 
if ($total_pages > 1) {
    cp_the_view_more_ads_link($post_type_url);
}
?>

					</div><!-- /block1 -->


					<!-- tab 2 -->
					<div id="block2">

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

						<div class="post-block-out post-block popular-placeholder"><!-- dynamically loaded content --></div>

					</div><!-- /block2 -->
示例#2
0
/**
 * Outputs a listing of random ads.
 *
 * @since 3.5
 */
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');
    }
}