Last active
December 11, 2017 14:01
-
-
Save ilokano/47d983b61eec22a0709d3e12cd1bfffe to your computer and use it in GitHub Desktop.
My custom WordPress functions for admin
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 | |
/** | |
* Custom admin functions for this theme | |
* | |
* | |
* @package Jasper_Espejo_Theme | |
*/ | |
/** | |
* Customize login and admin | |
*/ | |
function jae_enqueue_admin_style() { | |
wp_enqueue_style( 'core', get_template_directory_uri() . '/admin/admin.css', false ); | |
} | |
add_action( 'admin_enqueue_scripts', 'jae_enqueue_admin_style' ); | |
/* Custom login logo */ | |
function jae_enqueue_login_style() { | |
wp_enqueue_style( 'core', get_template_directory_uri() . '/admin/login.css', false ); | |
} | |
add_action( 'login_enqueue_scripts', 'jae_enqueue_login_style', 10 ); | |
/* Change the URL of the WordPress login logo */ | |
function jae_url_login_logo(){ | |
return home_url(); | |
} | |
add_filter('login_headerurl', 'jae_url_login_logo'); | |
/* Change login logo hover text */ | |
function jae_login_logo_url_title() { | |
return get_bloginfo( 'name' ); | |
} | |
add_filter( 'login_headertitle', 'jae_login_logo_url_title' ); | |
/** | |
* Clean up dashboard | |
*/ | |
function jae_remove_dashboard_widgets() { | |
// Main column | |
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' ); | |
remove_meta_box( 'woocommerce_dashboard_status', 'dashboard', 'normal' ); | |
remove_meta_box( 'woocommerce_dashboard_recent_reviews', 'dashboard', 'normal' ); | |
remove_meta_box( 'wpseo-dashboard-overview', 'dashboard', 'normal' ); | |
// Side column | |
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); | |
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' ); | |
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' ); | |
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' ); | |
//remove_meta_box( 'woocommerce_dashboard_status', 'dashboard', 'side' ); | |
} | |
add_action('wp_dashboard_setup', 'jae_remove_dashboard_widgets' ); | |
/** | |
* Custom dashboard panel | |
*/ | |
function jae_add_dashboard_widgets() { | |
add_meta_box('jae_dashboard_widget', 'Website Support', 'jae_theme_info', 'dashboard', 'side', 'high'); | |
} | |
function jae_theme_info() { | |
echo "<ul> | |
<li><strong>Developed By:</strong> Jasper Espejo</li> | |
<li><strong>Website:</strong> <a href='https://jasperespejo.com/'>jasperespejo.com</a></li> | |
<li><strong>Contact:</strong> <a href='mailto:me@jasperespejo.com'>me@jasperespejo.com</a></li> | |
</ul>"; | |
} | |
add_action('wp_dashboard_setup', 'jae_add_dashboard_widgets' ); | |
/* | |
* Customize the admin footer text | |
* | |
*/ | |
function jae_modify_footer_admin() { | |
$sitename = get_bloginfo( 'name' ); | |
echo '<span id="footer-thankyou">© ' . date("Y"). ' ' . $sitename . ' | Web development by <a href="//jasperespejo.com/" target="_blank">jasperespejo.com</a></span>'; | |
} | |
add_filter('admin_footer_text', 'jae_modify_footer_admin'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment