[Resolved] Featured Excerpt Not Displaying After Title

Home Forums Support [Resolved] Featured Excerpt Not Displaying After Title

Home Forums Support Featured Excerpt Not Displaying After Title

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1661002
    Jason

    Hi,

    I’m using the following code to display the featured excerpt above the featured image and below the post title. The code works and it displays the excerpt, but it also displays the following:

    /home/nginx/domains/mysitehere.com/public/wp-content/plugins/code-snippets.back/php/snippet-ops.php(446) : eval()’d code on line 4

    add_action(‘generate_after_entry_title’, ‘db_single_post_excerpt’);
    function db_single_post_excerpt() {
    if ( is_single() && has_excerpt() ) {
    $single_excerpt = apply_filters(‘the_excerpt’, get_post_field(‘post_excerpt’, $post_id));
    echo ‘

    ‘ . $single_excerpt . ‘

    ‘;
    }
    }

    #1661004
    Jason

    I’m looking for help getting that line of code removed.

    #1661155
    Elvin
    Staff
    Customer Support

    Hi there,

    Can you try this instead?

    add_action('generate_after_entry_title', 'db_single_post_excerpt');
    function db_single_post_excerpt() {
        if ( is_single() && has_excerpt() ) {
            $single_excerpt = apply_filters('the_excerpt', get_post_field('post_excerpt', get_the_ID()));
            echo '' . $single_excerpt . '';
        }
    }

    Let us know how it goes.

    A wise man once said:
    "Have you cleared your cache?"

    #1663402
    Jason

    That worked, thanks.

    #1663900
    Elvin
    Staff
    Customer Support

    Glad it works for you. No problem. 😀

    A wise man once said:
    "Have you cleared your cache?"

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.