Skip to content

Instantly share code, notes, and snippets.

@Pross
Created October 19, 2014 18:30
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 Pross/a466bb21785847624eae to your computer and use it in GitHub Desktop.
Save Pross/a466bb21785847624eae to your computer and use it in GitHub Desktop.
Fix chronos in editor...
<?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