Excerpt in a text widget on the actual post page?
I’m using the excerpt field on my blog in addition to the “more” tag. The front page shows each post up to the “more” tag with a “read more” button, but I use the excerpt field to store the author’s synopsis of the article. The only place I want to display the excerpt is on the actual post page, in a text widget. Naively, I thought I could just call the_excerpt() or get_the_excerpt() in the text widget.
Boy was I wrong.
After a crash course in the loop, I now understand why that wouldn’t work. I’ve found a lot of tutorials showing how to add a function and then call that function from the widget in order to get things that are “inside” the loop such as the excerpt. Unfortunately, I need to pass the post ID to the function, and my text widget doesn’t seem to know how to deal with the post->ID. In other words, if I put in
<?php get_excerpt_outside(post->ID); ?>
the widget will output
(And that’s assuming I’ve even written the function correctly.)
I know I’m clueless and don’t have any business attempting this on my own, but I can’t find a simple plugin to accomplish it. Can anyone offer any advice?
- The topic ‘Excerpt in a text widget on the actual post page?’ is closed to new replies.