-
-
Save jimboobrien/1d537940de76e0132464e1b7903acc67 to your computer and use it in GitHub Desktop.
Sample class to demonstrate how classes can be used 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
<?php | |
/** | |
* Class PostContentAppender | |
*/ | |
class PostContentAppender { | |
protected $append = ''; | |
public function __construct( $append ) { | |
$this->append = $append; | |
add_action( 'the_content', array( $this, 'append_content' ) ); | |
} | |
public function append_content( $content ) { | |
return $content . $this->append; | |
} | |
} | |
$appender = new PostContentAppender('<p>Posted by Micah Wood</p>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment