本文整理汇总了PHP中twentyfourteen_get_featured_posts函数的典型用法代码示例。如果您正苦于以下问题:PHP twentyfourteen_get_featured_posts函数的具体用法?PHP twentyfourteen_get_featured_posts怎么用?PHP twentyfourteen_get_featured_posts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了twentyfourteen_get_featured_posts函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_action
* @package WordPress
* @subpackage Twenty_Fourteen
* @since bt2n 1.0
*/
?>
<div id="featured-content" class="featured-content">
<div class="featured-content-inner">
<?php
/**
* Fires before the bt2n featured content.
*
* @since bt2n 1.0
*/
do_action('twentyfourteen_featured_posts_before');
$featured_posts = twentyfourteen_get_featured_posts();
foreach ((array) $featured_posts as $order => $post) {
setup_postdata($post);
// Include the featured content template.
get_template_part('content', 'featured-post');
}
/**
* Fires after the bt2n featured content.
*
* @since bt2n 1.0
*/
do_action('twentyfourteen_featured_posts_after');
wp_reset_postdata();
?>
</div><!-- .featured-content-inner -->
</div><!-- #featured-content .featured-content -->
示例2: twentyfourteen_has_featured_posts
/**
* A helper conditional function that returns a boolean value.
*
* @since Twenty Fourteen 1.0
*
* @return bool Whether there are featured posts.
*/
function twentyfourteen_has_featured_posts()
{
return !is_paged() && (bool) twentyfourteen_get_featured_posts();
}
示例3: twentyfourteen_get_recent
/**
* Gets recent formatted posts that are not featured in FC plugin.
*
*/
function twentyfourteen_get_recent($post_format)
{
$args = array('order' => 'DESC', 'ignore_sticky_posts' => 1, 'posts_per_page' => 2, 'tax_query' => array(array('taxonomy' => 'post_format', 'terms' => array($post_format), 'field' => 'slug', 'operator' => 'IN')), 'no_found_rows' => true);
$featured_posts = twentyfourteen_get_featured_posts();
if (is_array($featured_posts) && !empty($featured_posts)) {
$args['post__not_in'] = wp_list_pluck($featured_posts, 'ID');
}
return new WP_Query($args);
}