Created
January 11, 2018 05:10
-
-
Save pbrocks/1b42f2e26099e46e838dcb841ead226f to your computer and use it in GitHub Desktop.
neato-content-filter.php is a sample filter for the_content in WordPress
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
| add_filter( 'the_content', 'neato_content_filter', 20 ); | |
| /** | |
| * Add a spinning icon to the beginning of every post page. | |
| * | |
| * @uses is_single() | |
| */ | |
| function neato_content_filter( $content ) { | |
| if ( is_page() ) { | |
| // Add image to the beginning of each page | |
| $content = sprintf( | |
| '<img class="post-icon" src="%s/images/spinner-2x.gif" alt="Post icon" title=""/>%s', | |
| home_url( 'wp-includes' ), | |
| $content | |
| ); | |
| } | |
| // Returns the content. | |
| return $content; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment