what's the difference between get_posts and the_content?
What's the difference ? How to re开发者_JS百科place the_content (used within a loop) with get_posts ?
Basically the_loop is similar with
foreach (get_posts('showpost=-1') as $mypost) { //and the output of the_content is similar with echo $mypost->post_content; }
PS : when you don't use the_content in a proper LOOP
and change it with the above approach, then you will lose several wordpress features such as Shortcode API, Content Sanitation, etc. These feature will help you clean your content and add more feature.
get_posts() does what the name says: collecting a bunch of posts. the_content() returns the content of a single post. They are not interchangeable.
Template Tags/the content « WordPress Codex, and you're probably interested in Template Tags/the excerpt « WordPress Codex, too.
精彩评论