Support » Fixing WordPress » How do I show only excerpts in Twenty Seventeen theme?

  • I’m using Twenty Seventeen theme. I’ve set it to show latest posts on front page. And in the “For each article in a feed, show” section I’ve selected “Summary.”

    But it still shows the full post instead of post excerpts. How can I show the excerpts only? Please help me.

Viewing 7 replies - 1 through 7 (of 7 total)
  • “For each article in a feed, show” section I’ve selected “Summary.”

    That is not applicable here. It is meant for RSS feed.

    But it still shows the full post instead of post excerpts. How can I show the excerpts only?

    Whether the page shows full content or except, depends on 2 things:
    1. What is the except length defined in WordPress
    2. Whethere you have placed the <!–more–> tag in the post content at the correct place where you want to show “Read more” or “Continue reading”

    So if your content is 10 lines long, and you want to show only 2 lines in the except, then you have to place the <!–more–> tag after two lines.

    In this case your content should look like:

    Line 1
    Line 2
    <!--more-->
    Line 3
    Line 4
    Line 5
    Rinku Y

    (@rinkuyadav999)

    index.php and archive.php files use to display archives / post in loop, so:

    You can replace get_post_format() with ‘excerpt’ in file index.php Line 45

    also You can replace get_post_format() with ‘excerpt’ in file archive.php Line 40

    It will better you create child theme and make these changes otherwise your codes will removed when you will update theme. https://codex.wordpress.org/Child_Themes

    Looks like twentyseventeen theme is hard-coded to show the full content at all places including the archive pages. The only place where it shows the excerpt is the search results.

    So, the only solution would be to create child theme and make the changes suggested by @rinkuyadav999

    The code located at http://www.blogmynotes.com/display-post-excerpt-twenty-seventeen-wordpress-theme/ works well, though make sure you upload template-parts/post/content.php to your child theme – don’t overwrite the parent theme as the post I linked to suggests to do.

    Whilst it would be nice to have a theme setting for this, you can just use the <!–more–> tag as @shariqkhan2012 originally suggested (there is a button for it in the visual editor). I have tested that this does work.

    It will then cut-off the post at the point you specify for your categories, homepage, tag pages etc.

    @rinkuyadav999 Hi bro, I tried your suggestion, but it still didn’t work. Is there any other way? Thanks

    Rinku Y

    (@rinkuyadav999)

    Hi @madesoma

    Simply find:
    get_template_part( 'template-parts/post/content', get_post_format() );
    Replace with:
    get_template_part( 'template-parts/post/content', 'excerpt' );

    in index.php Line 45 and archive.php Line 40

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