Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #717169

    Hi there,

    I would very much like to know how I can add the excerpt to a single post on the front end.

    I don’t want to use the advanced layout editor. I’ve added some content to the excerpt meta box and now I want to show it on the full article display.

    Thanks!

    #717177

    Hey Webfixers,

    Would you mind providing a precise link to your site, showing which post you need to add excerpt? We need to be able to inspect them in order to help :)

    Best regards,
    Vinay

    • This reply was modified 7 years, 4 months ago by Vinay.
    #717245

    Hi Vinay,

    sure no problem.

    #718021

    Hi!

    I am not sure if i understood the changes you would like to make clearly. Your blog overview page shows the excerpt of your post at the moment. Can you please elaborate on the changes you would like to make?

    Best regards,
    Yigit

    #718061

    Hi!

    I’d like the excerpt to also be shown a the single page view of the post.

    Thanks for helping out!

    #719659

    Hi,

    this is about WordPress default behavior (and not about a theme issue). So check out how WordPress is controling excerpt function:
    http://www.wpbeginner.com/wp-themes/how-to-display-post-excerpts-in-wordpress-themes/
    https://codex.wordpress.org/Excerpt

    Best regards,
    Andy

    #720413

    Hi Andy,

    In this case it is actually theme behavior as I am trying to add the excerpt to a page template to show it on the front end.

    I have added content to the excerpt meta box in the admin, and now I’d like to show it on the front end. I will send you a private link to the page I am trying to get this to work on.

    Thanks

    #720873

    Hi,

    It’s not clear what you are trying to achieve. However it appears you are trying to add an excerpt to a single blog post entry and not on the blog post archive page ? Is that correct?

    Wordpress do not allow this but if you think this is a theme feature as seen here http://kriesi.at/themes/enfold-overview/ please share the link to the page (close the iframe before copying the URL) and we will surely help you achieve the same :)

    If you do not see on our demos please point us to any other site where you see what you are trying to achieve.

    Also let us know what is the purpose you are trying to add an excerpt to a single blog post ?

    Thank you for reaching out to us, happy to help :)

    Best regards,
    Vinay

    #720903

    Hi Vinay,

    thanks for your elaborate response and sorry for the confusion.

    what I am trying to achieve is to have the excerpt automatically added to the full single posts display on the front end to use it as ‘lead text’ (intro) to the article so I can easily make it stand out with CSS. That way the user doesn’t have to manualy add styling to the lead text of every article to make it stand out.

    My thinking is this: if the user is going to the trouble of writing a summary in the excerpt meta box you might as well use that as lead/intro text on the full article page. With the added benefit of being able to easily add some css (bold and slighly larger font for instance) to make it stand out.

    If you think there is a better, more user friendly way of achieving this, let me know.

    Kind regards

    #722193

    Hi,

    You can try creating a shortcode such as following one

    function my_custom_excerpt() {
        if(is_single()){
            ob_start();
            $output = "<span class='custom-excerpt'>". the_excerpt('',false) ."</span>";    
            $output = ob_get_clean();
            echo $output;
        }
    }
    add_shortcode( 'custom_excerpt', 'my_custom_excerpt' );

    and then add [custom_excerpt] to top of your posts and adjust the styling using

    .custom-excerpt { font-size: 20px; font-weight: bold; }

    Best regards,
    Yigit

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