WordPress.org

Ready to get started?Download WordPress

Forums

How to add a summary on top of a single post (7 posts)

  1. hotinthenews
    Member
    Posted 3 years ago #

    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

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    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().

  3. hotinthenews
    Member
    Posted 3 years ago #

    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

  4. chinmoy
    Member
    Posted 3 years ago #

    r you add a static content above a single post?

  5. hotinthenews
    Member
    Posted 3 years ago #

    Hello chinmoy29

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

    Lode

  6. chinmoy
    Member
    Posted 3 years ago #

    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.

  7. hotinthenews
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic