我只想(在主页上)显示粘性帖子的youtube视频(或vimeo)。
我从中找到此代码
/*Sticky list variables en page d\'accueil*/
function wpb_latest_sticky() {
/* Get all sticky posts */
$sticky = get_option( \'sticky_posts\' );
/* Get the 5 newest stickies (change 5 for a different number) */
$sticky = array_slice( $sticky, 0, 1 );
/* Query sticky posts */
$the_query = new WP_Query( array( \'post__in\' => $sticky, \'ignore_sticky_posts\' => 1 ) );
// The Loop
if ( $the_query->have_posts() ) {
$return .= \'<ul>\';
while ( $the_query->have_posts() ) {
$the_query->the_post();
$return .= \'<li><a href="\' .get_permalink(). \'" title="\' . get_the_title() . \'">\' . get_the_title() . \'</a><br />\' . get_the_content(). \'</li>\';
}
$return .= \'</ul>\';
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
return $return;
}
add_shortcode(\'latest_stickies\', \'wpb_latest_sticky\');
我有两个问题:
它将显示帖子的所有内容
非常感谢