good morning,
I open a new thread because maybe my post in https://generatepress.com/forums/topic/missing-excerpt-in-blog-post/ was not seen, been that post already marked as solved.
in order to add the excerpt under the title on single post pages I used the code provided by david
<?php
if ( has_excerpt() ) {
$single_excerpt = apply_filters(‘the_excerpt’, get_post_field(‘post_excerpt’, $post_id));
echo ‘
‘ . $single_excerpt . ‘
‘;
}
?>
but i got an error together with the excerpt. this was the error
Notice: Undefined variable: post_id in /home/xxx/public_html/xxx/wp-content/plugins/gp-premium/elements/class-hooks.php(180) : eval()’d code on line 3
removing , $post_id from david’s code, it works, but I would like to know if now the edited code I am using is correct or not
<?php
if ( has_excerpt() ) {
$single_excerpt = apply_filters(‘the_excerpt’, get_post_field(‘post_excerpt’));
echo ‘
‘ . $single_excerpt . ‘
‘;
}
?>
thank you for your help
alex