我正在尝试获得一个rss提要,它将显示本周前10位的帖子。我正在使用top 10 popular posts插件将它们显示在网站的侧栏中,这很好,但需要在rss中显示它们,这样我就可以让它们发送出去的电子邮件。下面是10大API的一些代码。任何帮助都会很好。
<?php
/*
* This example fetches the popular posts tracked by Top 10.
*
*/
if ( function_exists( \'get_tptn_pop_posts\' ) ) {
$settings = array(
\'daily\' => TRUE,
\'daily_range\' => 30,
\'limit\' => 20,
\'strict_limit\' => FALSE,
);
$topposts = get_tptn_pop_posts( $settings ); // Array of posts
$topposts = wp_list_pluck( (array) $topposts, \'postnumber\' );
$args = array(
\'post__in\' => $topposts,
\'orderby\' => \'post__in\',
\'posts_per_page\' => 7,
\'ignore_sticky_posts\' => 1
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();
echo \'<a href="\' . get_permalink( get_the_ID() ) . \'">\';
the_title();
echo \'</a>\';
wp_reset_postdata();
}
} else {
}
wp_reset_query();
}