Last active
June 7, 2021 12:26
-
-
Save wbcomdev/a057d6481bb46ff71bfa95d6bae3aeb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Set Limit of content length. | |
| * | |
| * @param mixed $content | |
| * @return void | |
| */ | |
| function wbcom_limit_content_length( $content ) { | |
| if ( 'post' === get_post_type() ) { | |
| return mb_strimwidth( strip_tags( $content ), 0, 100, '...' ); | |
| } else { | |
| return $content; | |
| } | |
| } | |
| add_filter( 'the_content', 'wbcom_limit_content_length' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment