What's the difference ? How to replace the_content (used within a loop) with get_posts ?
+1
A:
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.
toscho
2010-04-04 15:31:59
Well I mean the_content within a loop
2010-04-04 18:00:32
Of course, `the_content()` cannot be used outside of the loop.
toscho
2010-04-04 18:14:22
+1
A:
Template Tags/the content « WordPress Codex, and you're probably interested in Template Tags/the excerpt « WordPress Codex, too.
songdogtech
2010-04-05 04:02:10
+1
A:
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.
justjoe
2010-04-05 07:38:42
it's PHP. It's call foraech...i will try to find the link for you or try search in php.net
justjoe
2010-04-05 07:52:43