コード例 #1
0
/**
 * Filter the home page posts, and remove any featured post ID's from it. Hooked
 * onto the 'pre_get_posts' action, this changes the parameters of the query
 * before it gets any posts.
 *
 * @global array $featured_post_id
 * @param WP_Query $query
 * @return WP_Query Possibly modified WP_query
 */
function sundance_home_posts($query = false)
{
    // Bail if not home, not a query, not main query, or no featured posts
    if (!is_home() || !is_a($query, 'WP_Query') || !$query->is_main_query() || !sundance_featuring_posts()) {
        return $query;
    }
    // Exclude featured posts from the main query
    $query->query_vars['post__not_in'] = sundance_featuring_posts();
    return $query;
}
コード例 #2
0
ファイル: featured.php プロジェクト: JuiceCrawl/juicecrawldev
 *
 * @package Sundance
 * @since Sundance 1.0
 */
/**
 * Begin the featured posts section.
 *
 * See if we have any sticky posts and use them to create our featured posts.
 */
// Set $content_width for the slider
global $content_width;
$content_width = 644;
// Proceed only if sticky posts exist.
if (sundance_featuring_posts()) {
    // The Featured Posts query - The need to be sticky post and video post format
    $featured_args = array('post__in' => sundance_featuring_posts(), 'posts_per_page' => 10, 'no_found_rows' => true, 'ignore_sticky_posts' => 1);
    $featured = new WP_Query($featured_args);
    // Proceed only if published posts exist
    if ($featured->have_posts()) {
        ?>

		<div class="featured-posts-super-wrapper loading">
			<div class="featured-posts-wrapper">
				<div class="featured-posts-outer">
					<div class="featured-posts">
						<ul class="slides">
						<?php 
        while ($featured->have_posts()) {
            $featured->the_post();
            ?>
							<li class="featured">