[wp-hackers] return automatic excerpt?

Michael B miklb.online at gmail.com
Thu Nov 2 22:43:42 GMT 2006


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


More information about the wp-hackers mailing list