• I would like to increase the length of the sticky post on my homepage. I’m using the sticky post as a place for a short description of our program and I would like the entire text to show there.

    Right now, the sticky post preview is cut off after 2.5 lines. I’d like to allow only the sticky post to be of infinite length. If that isn’t possible, then I’d like to increase the preview length of all posts to 4 lines so that all of the sticky post text would show.

    I’m guessing I need to add something to my child theme’s style sheet. I’ve scanned the parent theme’s (Stargazer) style sheet but I don’t see what I should edit. Any help appreciated!

    My site: https://www.mesaverdegardens.org/

Viewing 1 replies (of 1 total)
  • Theme Author Justin Tadlock

    (@greenshady)

    Changing the length is pretty easy though. Showing the full text is a bit more complicated than I can show you here. The following code will allow you to alter the length of the excerpt shown. Add it to your child theme’s functions.php file.

    add_filter( 'excerpt_length', 'my_excerpt_length', 99 );
    
    function my_excerpt_length( $length ) {
    
    	if ( is_home() && is_sticky() ) {
    		$length = 30;
    	}
    
    	return $length;
    }

    You can change the 30 to whatever number suits you best. The theme currently uses 30, so you’ll want to bump that up.

    If you need further help with the theme, I encourage you to check out my professional support forum at Theme Hybrid.

Viewing 1 replies (of 1 total)
  • The topic ‘Increase sticky post preview length’ is closed to new replies.