View add to head
add_action('wp_head', 'wpse_43672_wp_head');
function wpse_43672_wp_head(){
//Close PHP tags
?>
ADD YOUR PLAIN HTML CODE HERE
<?php //Open PHP tags
}
View cat-order
/* ----------------------------------- stop categories going out of order in WP page/poasts admin ---------------*/
function taxonomy_checklist_checked_ontop_filter ($args)
{
$args['checked_ontop'] = false;
return $args;
}
View 404 to 301
/* Redirect 404 to correct page */
add_filter( '404_template', 't5_redirect_to_category' );
function t5_redirect_to_category( $template )
{
if ( ! is_404() )
return $template;
global $wp_rewrite, $wp_query;
View gist:8b17ca7ffc8f2e725f18
/* = Add a "molly guard" to the publish button */
add_action( 'admin_print_footer_scripts', 'sr_publish_molly_guard' );
function sr_publish_molly_guard() {
echo <<<EOT
<script>
jQuery(document).ready(function($){
$('#publishing-action input[name="publish"]').click(function() {
if(confirm('Are you sure you want to publish this?')) {
return true;
View cat-class-to-body
// add category class to body
function body_class_add_categories( $classes ) {
// Only proceed if we're on a single post page
if ( !is_single() )
return $classes;
// Get the categories that are assigned to this post
$post_categories = get_the_category();
View wp-white-screen-of-death
// add to wp-config.php to view errors if your WP install only shows a white page
error_reporting(E_ALL); ini_set('display_errors', 1);
define( 'WP_DEBUG', true);
View hide_admin_functions
// ------------------------------hide admin menus in sidebar
function remove_menu_items() {
global $menu;
$restricted = array(__('Dashboard'), __('Pages') , __('Posts'), __('Comments'), __('Media'), __('Plugins'), __('Appearance'), __('Settings'), __('Tools'), __('Users'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){
unset($menu[key($menu)]);}
View hide_deactivation_link.php
View hidethemes.php
// hide themes menu in WordPress admin for users other than developer
add_action( 'admin_init', 'slt_lock_theme' );
function slt_lock_theme() {
global $submenu, $userdata;
get_currentuserinfo();
if ( $userdata->ID != 1 ) {
unset( $submenu['themes.php'][5] );
unset( $submenu['themes.php'][15] );
}
}
View svg_upload.php
// enable svg format file upload
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
// add the file extension to the array
$existing_mimes['svg'] = 'mime/type';