Skip to content

Instantly share code, notes, and snippets.

@amostajo
Created April 22, 2016 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amostajo/826810a98903001a3eff645830178838 to your computer and use it in GitHub Desktop.
Save amostajo/826810a98903001a3eff645830178838 to your computer and use it in GitHub Desktop.
Wordpress MVC - Main Class sample
<?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