Created
April 22, 2016 05:55
-
-
Save amostajo/826810a98903001a3eff645830178838 to your computer and use it in GitHub Desktop.
Wordpress MVC - Main Class sample
This file contains 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 | |
// @link http://wordpress-dev.evopiru.com/documentation/main-class/ | |
class Main extends Theme | |
{ | |
public function init() | |
{ | |
// Adding filter with callback function within Main Class | |
add_filter( 'the_content', [ &$this, 'filter_content' ] ); | |
// Adding filter with callback located in a controller. Controller: PostController Method: filter_content() | |
$this->add_filter( 'the_content', 'PostController@filter_content' ); | |
// Adding shortcode [hello] generated by view located at 'views/shout/hello.php' | |
$this->add_shortcode( 'hello', 'view@shout.hello' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment