Last active
December 17, 2015 13:59
-
-
Save alexkingorg/5621202 to your computer and use it in GitHub Desktop.
Hide unused post formats in WordPress 3.6.
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 | |
/* | |
Plugin Name: AK.org Hide Post Format Tabs | |
Plugin URI: https://gist.github.com/alexkingorg/5557869 | |
Description: Reduce the footprint of the post format tabs in the WordPress admin UI. | |
Version: 1.0 | |
Author: Alex King | |
Author URI: http://alexking.org | |
License: GPL2 | |
*/ | |
function akv3_remove_format_tabs() { | |
?> | |
<script type="text/javascript"> | |
jQuery(function($) { | |
// SET THIS TO YOUR UNUSED FORMATS | |
// image, gallery, link, video, audio, chat, status, quote, aside | |
var unusedFormats = ['aside', 'chat', 'audio']; | |
$('.post-format-options a').each(function() { | |
var format = $(this).data('wp-format'); | |
if ($.inArray(format, unusedFormats) !== -1) { | |
$(this).remove(); | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} | |
add_action('admin_head-post.php', 'akv3_remove_format_tabs'); | |
add_action('admin_head-post-new.php', 'akv3_remove_format_tabs'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment