将此函数复制并粘贴到函数中。currenttheme下的php文件。
// Create a new filtering function that will add where clause to the query
function filter_where( $where = \'\' ) {
// posts in the last 30 days
$where .= " AND post_date > \'" . date(\'Y-m-d\', strtotime(\'-30 days\')) . "\'";
return $where;
}
将其粘贴到需要显示的位置。
$sticky = get_option( \'sticky_posts\' );
$args = array(
\'numberposts\' => -1
\'post__in\' => $sticky,
\'author\' => $current_user->ID
);
add_filter( \'posts_where\', \'filter_where\' );
$query = new WP_Query( $args );
remove_filter( \'posts_where\', \'filter_where\' );
// The Loop
while ( $the_query->have_posts() ) :
$the_query->the_post();
echo \'<li>\' . get_the_title() . \'</li>\';
endwhile;