Is there a way of hiding a blog posts text if it's longer than let's say 300 characters.

I don't want it to push the rest of the content below the fold.

You know, the show more text thing.


You could use this filter which can be found in the default WordPress themes functions.php file (twentyten). This will limit the post to 300 characters, so theres no need to hide it.

function twentyten_excerpt_length( $length ) {
    return 300;
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );

There are other means to achieve the same thing, but stick to whats already available and you should be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.