I'm currently doing some customisations to it, and have added post excerpts to display, along with date published, and so on.
My issue is with excerpts, i'm currently doing this:
' . $findpost->post_excerpt . '
in // all other posts except the current post, only this bypasses the features of the_excerpt, specifically not allowing the word length to be specified. I also like the other features of the_excerpt.
So my question, how can i show a post excerpt properly so i get all the features of the_excerpt?
8:55 pm September 8, 2009
Ade
Admin
posts 1140
2
Glad you're enjoying it.
the_excerpt doesn't take any parameters and therefore you can't specify the number of words to display. It either shows the first 55 words or the words you manually enter in the excerpt box in the Post Editor.
but how do i use the_excerpt instead of the one i was using, post_excerpt?
9:54 pm September 8, 2009
Ade
Admin
posts 1140
4
They are the same thing.
the_excerpt is the normal template tag used in the Loop, whereas post_excerpt is a parameter of the $post object. Both return exactly the same content, they are just used in different coding contexts.
hmmm, am i missing something here? as stated in the the_excerpt() codex page:
"Displays the excerpt of the current post with [...] at the end, which is not a "read more" link. If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt field), it will display a teaser which refers to the first 55 words of the post's content."
So at the very least if i use $post_excerpt as i have done, i should have "…" at the end of the excerpt, which i do not. And in posts that do not have an excerpt, it should display that first 55 chars of the content, but nothing is displayed.
Ok, you've misunderstood and I've slightly misled you. post_excerpt is a direct extraction from the db, therefore if the Excerpt hasn't been created manually, it will be empty. On the other hand, the_excerpt() function extracts the post_excerpt from the db and, if it is empty, automatically creates the excerpt from the first 55 words of your post. As I mentioned before, they are designed to be used in different coding contexts.
As for the [...], this is added by the_excerpt() and does not exist in the db, hence post_excerpt doesn't have it.
understood. The question still arises, and it was a simple one, can, in your plugin code, i use the_excerpt somehow instead of post_excerpt like in the example i initially gave, which was:
' . $findpost->post_excerpt . '
I didn't feel this was abusing your help, i thought it was a really simple question that just seems to be getting sidetracked.
Thanks.
8:03 am September 9, 2009
Ade
Admin
posts 1140
8
Try it and see. You won't get the [...] link and you will need to have manually created the exceprt in your posts, as per the previous discussion on this.
Developing plugins for the community represents a considerable investment of my time and energy. If you have found these plugins useful, please consider making a donation to help support future development. Your support will be much appreciated. Thank you!