當前位置: 首頁>>代碼示例>>PHP>>正文


PHP twentyfourteen_get_featured_posts函數代碼示例

本文整理匯總了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 -->
開發者ID:bichttn,項目名稱:bichttn,代碼行數:31,代碼來源:featured-content.php

示例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();
}
開發者ID:riteshkmr33,項目名稱:ovessnce,代碼行數:11,代碼來源:functions_bck_1_12_2014.php

示例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);
}
開發者ID:openify,項目名稱:wordpress-composer,代碼行數:13,代碼來源:functions.php


注:本文中的twentyfourteen_get_featured_posts函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。