Archived topic
Custom Excerpt Length for Single Category in Child Theme
3 replies · Started by Dee Broughton on May 8, 2015
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.
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 :)
Works perfectly. Thanks bunches. :)
You're welcome! :)