Support » Theme: Shoreditch » Show only post excerpt in the front page

  • Resolved binary10

    (@binary10)


    This theme shows the full post by default in the homepage. I wanted to show only the post excerpts but could not figure out how to do this. I tried changing setting from WordPress menu but that dowsn’t work.
    Settings> Reading> For each article in a feed, show Summary.
    Any suggestions on that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    I tried changing setting from WordPress menu but that dowsn’t work.
    Settings> Reading> For each article in a feed, show Summary.

    That setting applies only for RSS feeds, not the front end — it’s a common source of confusion.

    To display excerpts on your blog, you’ll need either a plugin — such as https://wordpress.org/plugins/easy-custom-auto-excerpt/ — or some code changes in a child theme.

    If you prefer the child-theme route, here are the steps:

    1. First, set up your child theme. Making a child theme means your changes won’t be overwritten when you update the theme. If you’re new to child themes, you can explore these guides:

    http://codex.wordpress.org/Child_Themes
    https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/

    2. In your child theme folder, create a folder called template-parts and copy the content.php file from your parent into that sub-folder in your child theme.

    3. In your child theme’s copy of content.php, change line 32 from this:

    the_content( sprintf(

    to this:

    the_excerpt( sprintf(

    Let me know how it goes.

    Thanks for clarification. I am not a coder but I did the same thing:

    In your child theme’s copy of content.php, change line 32 from this:

    the_content( sprintf(
    
    to this:
    
    the_excerpt( sprintf(

    but then it starts showing excerpt in all pages even in the “post page” (the page which is supposed to display the entire post).

    Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    Oh yes, you’re right – sorry about that!

    Try replacing lines 32-36:

    the_content( sprintf(
      /* translators: %s: Name of current post. */
        wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'shoreditch' ), array( 'span' => array( 'class' => array() ) ) ),
        the_title( '<span class="screen-reader-text">"', '"</span>', false )
    ) );

    With this:

    if ( is_home() ) {
       the_excerpt(); 
       } else { 
       the_content( sprintf(
         /* translators: %s: Name of current post. */
        wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'shoreditch' ), array( 'span' => array( 'class' => array() ) ) ),
        the_title( '<span class="screen-reader-text">"', '"</span>', false )
        ) );
      }
    

    The new if/else condition should display excerpts only on the blog page.

    Let me know how it goes!

    Now its working as expected
    Thanks

    Moderator Kathryn

    (@zoonini)

    Automattic Happiness Engineer

    Great, glad to hear it’s working now!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show only post excerpt in the front page’ is closed to new replies.