Created
December 18, 2012 20:52
-
-
Save ericmann/4331872 to your computer and use it in GitHub Desktop.
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 regions { | |
static function initialize() | |
{ | |
// We need to process the_content as early as possible, to be sure that DOM tree identical to edited one | |
// Also, function accept 2 arguments, so when needed we can supply exact regions to apply | |
if ( !is_admin() ) { // We don't want to run this on the backend | |
if (true) { // until apply_filter use current()/next() | |
add_filter('the_content', array(self::instance(), 'content_split_join'), -99991, 2); | |
} else { | |
// Use split/join to proceed every piece independently | |
add_filter('the_content', array(self::instance(), 'content_split'), -99991, 2); | |
add_filter('the_content', array(self::instance(), 'content_join'), +99991); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment