WordPress.org

Support

Support » How-To and Troubleshooting » How to add a summary on top of a single post

How to add a summary on top of a single post

  • Hello;

    I wish to add a summary of post on top of each individual post. I use a plugin to automatically create an excerpt for every post I write, but when I use the_excerpt() command, it shows [empty] above the article.

    Has anyone any idea how I can accomplish this task?

    Thanks

    Lode
    http://www.nodeju.com

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi

    @esmi

    Forum Moderator

    I use a plugin to automatically create an excerpt for every post

    I think that’s your problem. Why use a plugin? WordPress can create an automatic excerpt for you – accessible via the_excerpt().

    Thank Esmi;

    Unfortunately that doesn’t work. I deactivated the auto-excerpt plugin and inserted the line <?php the_excerpt(); ?> in the single.php file above the <?php the_content(); ?> command. All I get is [empty] for the excerpt when I display the post without an auto-generated excerpt in it.

    Any other suggestions or thoughts?

    thanks

    Lode

    r you add a static content above a single post?

    Hello chinmoy29

    Not sure I understand what your asking me. Can you elaborate a bit?
    thanks.

    Lode

    I mean that you want to add a normal static content(summary) above the Single post content or add a dynamic content(summary) above the the Single post content??

    if you want to add a dynamic content(summary) then use the custom field option to view the summary.

    code: $summary = get_post_data('summary', $post->ID, true);

    summary is the custom field name.

    Hello chinmoy29;

    thank you very much. The “get_post_data()” give an undefined call function error but no worries.

    Based on your instructions I am using this command:

    <?php $summary = get_post_meta($post->ID, ‘summary’, true) ?>

    Then I just echo it to the screen and voila, just what I am after.
    Just wish I could have this done automatically but it will most definitely work for now.

    Thank you so very much. You’ve been a great help.

    Lode

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add a summary on top of a single post’ is closed to new replies.
Skip to toolbar