Created
March 16, 2022 12:42
-
-
Save wpflames/042b3c6cc3ae31493465fe6db2692e1a to your computer and use it in GitHub Desktop.
Add custom class to WordPress excerpt
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 | |
| // ========================================================================= | |
| // ADD CLASS TO EXCERPT | |
| // ========================================================================= | |
| function add_class_to_excerpt ($post_excerpt) { | |
| $post_excerpt = '<p class="whatever">' . $post_excerpt . '</p>'; | |
| return $post_excerpt; | |
| } | |
| add_filter ('get_the_excerpt','add_class_to_excerpt'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment