Created
October 19, 2014 18:30
-
-
Save Pross/a466bb21785847624eae to your computer and use it in GitHub Desktop.
Fix chronos in editor...
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 | |
/* | |
Usage... | |
If standard chronos shortcode is [chronos] then replace word 'whatever' on L24 with chronos | |
If standard chronos shortcode is [chronos someoption="24"] then replace word 'whatever' on L24 with chronos someoption="24" | |
Then simply use [safe_chronos] for your shortcode. | |
*/ | |
class Fix_Chronos { | |
function __construct() { | |
add_action( 'after_setup_theme', array( $this, 'add_new' ) ); | |
} | |
function add_new() { | |
add_shortcode( 'safe_chronos', array( $this, 'do_chronos' ) ); | |
} | |
function do_chronos() { | |
global $pldraft; | |
if( is_object( $pldraft ) && $pldraft->show_editor() ) { | |
return 'Not doing this while editor is on'; | |
} else { | |
return do_shortcode( '[whatever]' ); // <-- REPLACE whatever WITH CHRONOS SHORTCODE | |
} | |
} | |
} | |
new Fix_Chronos; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment