这会查询所有 WordPress 用户的帖子,但不包括自定义帖子类型。如何指定要包含的自定义帖子类型?
<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
echo 'User ID: ' . $current_user->ID . "\n";
//The Query
query_posts('author='.$current_user->ID );
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
the_title();
echo "<br>";
endwhile; else:
echo "The user has not contributed anything!";
endif;
//Reset Query
wp_reset_query();
} else {
echo 'Welcome, visitor!';
};
?>