Last active
August 29, 2015 14:20
-
-
Save blickwert/22531758a2ed593fe4dd to your computer and use it in GitHub Desktop.
Wordpress functionality
This file contains hidden or 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
// activate statify for editor | |
add_action('admin_init', 'add_theme_caps'); | |
function add_theme_caps() { | |
$role = get_role('editor'); | |
$role->add_cap('edit_dashboard'); | |
} |
This file contains hidden or 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
// wp_list_pages - add a haschildren class to parent | |
add_filter( 'page_css_class', 'add_parent_class', 10, 4 ); | |
function add_parent_class( $css_class, $page, $depth, $args ) { | |
if ( ! empty( $args['has_children'] ) ) | |
$css_class[] = 'has_children'; | |
return $css_class; | |
} |
This file contains hidden or 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
// 2.7 add current class to wp_list_categories on single posts | |
add_filter('wp_list_categories','style_current_cat_single_post'); | |
function style_current_cat_single_post($output) { | |
if( is_single() ) : | |
global $post; | |
foreach ( get_the_category($post->ID) as $cat ) { | |
$cats[] = $cat->term_id; | |
} | |
foreach($cats as $value) { | |
if(preg_match('#item-' . $value . '">#', $output)) { | |
$output = str_replace('item-' . $value . '">', 'item-' . $value . ' current-cat">', $output); | |
} | |
} | |
endif; | |
return $output; | |
} |
This file contains hidden or 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
// 2.9 deactivate Contractform7 JS & CSS | |
add_filter( 'wpcf7_load_js', '__return_false' ); | |
add_filter( 'wpcf7_load_css', '__return_false' ); | |
This file contains hidden or 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
// hide WordPress Update Notification for notadmins | |
add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 ); | |
function hide_update_notice_to_all_but_admin_users() { | |
if (!current_user_can('update_core')) { | |
remove_action( 'admin_notices', 'update_nag', 3 ); | |
} | |
} |
This file contains hidden or 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
add_action('wp_dashboard_setup', 'remove_dashboard_widgets'); | |
function remove_dashboard_widgets(){ | |
global $wp_meta_boxes; | |
// unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); | |
// unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); | |
// unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); | |
// unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); | |
// unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); | |
// unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); | |
// unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); | |
// unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); | |
} |
This file contains hidden or 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
// 2.5 remove metaboxes from admin | |
add_action( 'admin_menu', 'my_remove_meta_boxes' ); | |
function my_remove_meta_boxes() { | |
remove_meta_box('postexcerpt', 'post', 'normal'); | |
remove_meta_box('trackbacksdiv', 'post', 'normal'); | |
remove_meta_box('slugdiv', 'post', 'normal'); remove_meta_box('slugdiv', 'page', 'normal'); | |
remove_meta_box('authordiv', 'post', 'normal'); remove_meta_box('authordiv', 'page', 'normal'); | |
remove_meta_box('revisionsdiv', 'post', 'normal'); remove_meta_box('revisionsdiv', 'page', 'normal'); | |
// remove_meta_box('postcustom', 'post', 'normal'); remove_meta_box('postcustom', 'page', 'normal'); | |
} | |
This file contains hidden or 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
// 2.1 theme support | |
add_theme_support( 'post-thumbnails' ); // Pages only | |
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment