[Resolved] Custom Excerpt Length for Single Category in Child Theme

Home Forums Support [Resolved] Custom Excerpt Length for Single Category in Child Theme

Home Forums Support Custom Excerpt Length for Single Category in Child Theme

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #106523
    Dee Broughton

    I know this might not be a theme question exactly, but here’s what I’m trying to do:

    I created a child theme with only style.css and index.php.
    I added a line to index.php to make only one category show on the front page.
    That works.

    Now, I want that category to show full posts while all others still use the default excerpt length. I think it should be easy, but I haven’t been able to figure it out alone. Any easy way?

    I’m partly confused because I think I’d need functions.php in the child theme, but when I copy it into there, the theme breaks and the site goes blank.

    #106621
    Tom
    Lead Developer
    Lead Developer

    Hi Dee,

    functions.php is like style.css in child themes – it should be empty and only contain the custom stuff.

    As for your index.php, replace:

    get_template_part( 'content', get_post_format() );

    With:

    get_template_part( 'content', 'custom' );

    Then make a copy of content.php and name it content-custom.php.

    It should look like this: https://gist.github.com/generatepress/c2b2ee0b36793b445571

    Basically, I removed any reference to the_excerpt, so it’s only calling the_content, which will show the full content.

    Let me know if that helps or not πŸ™‚

    #106635
    Dee Broughton

    Works perfectly. Thanks bunches. πŸ™‚

    #106636
    Tom
    Lead Developer
    Lead Developer

    You’re welcome! πŸ™‚

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