Skip to content

Instantly share code, notes, and snippets.

@salcode
Last active December 31, 2015 20:21
Show Gist options
  • Save salcode/b6b298a77f1c35cfce1c to your computer and use it in GitHub Desktop.
Save salcode/b6b298a77f1c35cfce1c to your computer and use it in GitHub Desktop.
Fix for Mark Jaquith's "Markdown on Save" WordPress plugin on WordPress 4.4
<?php
/**
* Plugin Name: Markdown on Save 4.4. Fix
* Plugin URI: https://gist.github.com/salcode/b6b298a77f1c35cfce1c
* Description: Temporary fix for https://github.com/markjaquith/markdown-on-save/issues/13, which appears in WordPress 4.4 when running Markdown on Save 1.2.1
* Version: 1.0.0
* Author: Sal Ferrarello
* Author URI: http://salferrarello.com/
* Text Domain: markdown-on-save-4-4-fix
*
* Download from Command Line:
* curl -O https://gist.githubusercontent.com/salcode/b6b298a77f1c35cfce1c/raw/markdown-on-save-4-4-fix.php
*
* @package salcode/markdown-on-save-4-4-fix
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
add_action( 'post_submitbox_misc_actions', 'fe_mos_4_4_fix' );
/**
* Add CSS to force hidden checkbox to display
*
* Add this CSS only when 'Markdown on Save' 1.2.1 is active
*/
function fe_mos_4_4_fix() {
if ( ! is_plugin_active( 'markdown-on-save/markdown-on-save.php' ) ) {
return;
}
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/markdown-on-save/markdown-on-save.php' );
if ( ! isset( $plugin_data['Version'] ) || '1.2.1' !== $plugin_data['Version'] ) {
return;
}
?>
<style>
#cws_using_markdown { display: block !important; margin: 0 0 10px 10px; }
#cws_using_markdown::after { content: "Markdown"; display: block; padding: 8px 0 0 20px; }
</style>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment