[wp-hackers] return automatic excerpt?

Computer Guru computerguru at neosmart.net
Thu Nov 2 22:58:44 GMT 2006


Why do it manually?

Use the_content() to grab the post of your liking. It'll take care of all
that for you. 

To use the_content() just first run the SQL query that picks the post
number(s), then activate the_content() or get_the_content() depending on
your needs.

Computer Guru
NeoSmart Technologies
http://neosmart.net/blog/


> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-
> bounces at lists.automattic.com] On Behalf Of Michael B
> Sent: Friday, November 03, 2006 12:44 AM
> To: wp-hackers at lists.automattic.com
> Subject: [wp-hackers] return automatic excerpt?
> 
> I'm muddling my way through customizing a random post plugin to output
> the
> excerpt of a post with a read more link.  Currently it's only working
> if I
> put a manual excerpt in the post, how can I automatically output the
> excerpt.
> 
> Here's the code I'm using:
> $listContent =    stripslashes(str_replace('"', '',
> $display->post_excerpt));
> 
>                 //    Set up the return string
>                 if ( $before ) $result    .=    $before;
>                 $result  .=    '<a href="' . post_permalink($display-
> >ID) .
> '" rel="bookmark" title="Permanent link to &quot;' . $listTitle .
> '&quot;">'
> . $listTitle . '</a>'  . '<br />' . $listContent . '<a href="' .
> post_permalink($display->ID) . '" rel="bookmark" title="Permanent link
> to
> &quot;' . $listTitle . '&quot;">' . ' Read more' . '</a>' ;
> 
> Currently I'm simply pulling the field via
> $postSQL =  "SELECT
> $wpdb->posts.post_excerpt";
> 
> Thanks for any help.
> 
> ~miklb
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list