Created
April 30, 2013 13:19
-
-
Save joshgreen/5488627 to your computer and use it in GitHub Desktop.
Taming Wordpress
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
| /** | |
| Josh Function additions - Start | |
| **/ | |
| // remove junk from head | |
| remove_action('wp_head', 'rsd_link'); | |
| remove_action('wp_head', 'wp_generator'); | |
| remove_action('wp_head', 'feed_links', 2); | |
| remove_action('wp_head', 'index_rel_link'); | |
| remove_action('wp_head', 'wlwmanifest_link'); | |
| remove_action('wp_head', 'feed_links_extra', 3); | |
| remove_action('wp_head', 'start_post_rel_link', 10, 0); | |
| remove_action('wp_head', 'parent_post_rel_link', 10, 0); | |
| remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); | |
| // Remove login errors | |
| add_filter('login_errors', create_function('$a', "return null;")); | |
| //hide theme editor from WordPress dashboard | |
| function wpr_remove_editor_menu() { | |
| remove_action('admin_menu', '_add_themes_utility_last', 101); | |
| } | |
| global $remove_submenu_page, $current_user; | |
| get_currentuserinfo(); | |
| if($current_user->user_login == 'admin') { //Specify admin name here | |
| add_action('admin_menu', 'wpr_remove_editor_menu', 1); | |
| } | |
| // Remove Howdy | |
| add_action( 'admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11 ); | |
| function wp_admin_bar_my_custom_account_menu( $wp_admin_bar ) { | |
| $user_id = get_current_user_id(); | |
| $current_user = wp_get_current_user(); | |
| $profile_url = get_edit_profile_url( $user_id ); | |
| if ( 0 != $user_id ) { | |
| /* Add the "My Account" menu */ | |
| $avatar = get_avatar( $user_id, 28 ); | |
| $howdy = sprintf( __('Welcome, %1$s'), $current_user->display_name ); | |
| $class = empty( $avatar ) ? '' : 'with-avatar'; | |
| $wp_admin_bar->add_menu( array( | |
| 'id' => 'my-account', | |
| 'parent' => 'top-secondary', | |
| 'title' => $howdy . $avatar, | |
| 'href' => $profile_url, | |
| 'meta' => array( | |
| 'class' => $class, | |
| ), | |
| ) );} | |
| } | |
| // TypeKit Fonts | |
| /* | |
| * @since Theme 1.0 | |
| */ | |
| function theme_typekit() { | |
| wp_enqueue_script( 'theme_typekit', '//use.typekit.net/lzf0xqf.js'); | |
| } | |
| add_action( 'wp_enqueue_scripts', 'theme_typekit' ); | |
| function theme_typekit_inline() { | |
| if ( wp_script_is( 'theme_typekit', 'done' ) ) { ?> | |
| <script type="text/javascript">try{Typekit.load();}catch(e){}</script> | |
| <?php } | |
| } | |
| add_action( 'wp_head', 'theme_typekit_inline' ); | |
| //Clean up CSS link in head | |
| function hide_type($src) { | |
| return str_replace("type='text/css'", '', $src); | |
| } | |
| add_filter('style_loader_tag', 'hide_type'); | |
| function hide_media($media) { | |
| return str_replace("media='all'", '', $media); | |
| } | |
| add_filter('style_loader_tag', 'hide_media'); | |
| /** | |
| Josh Function additions - End | |
| **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment