Skip to content

Instantly share code, notes, and snippets.

@espellcaste
Forked from bsbeeks/Custom login page
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save espellcaste/1189cffe68f13b105c8c to your computer and use it in GitHub Desktop.

Select an option

Save espellcaste/1189cffe68f13b105c8c to your computer and use it in GitHub Desktop.

Revisions

  1. @bsbeeks bsbeeks created this gist Jan 13, 2015.
    11 changes: 11 additions & 0 deletions Custom login page
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    // Custom Logo Link
    function wpc_url_login() {
    return "http://twentycms.com/";
    }
    add_filter('login_headerurl', 'wpc_url_login');

    // Custom Login Styles (including logo)
    function login_css() {
    wp_enqueue_style( 'login_css', get_template_directory_uri() . '/css/login.css' );
    }
    add_action('login_head', 'login_css');
    4 changes: 4 additions & 0 deletions Disable draggable meta boxes
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    function disable_drag_metabox() {
    wp_deregister_script('postbox');
    }
    add_action( 'admin_init', 'disable_drag_metabox' );
    31 changes: 31 additions & 0 deletions Disable update notifications
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    # REMOVE WORDPRESS UPDATE NOTIFICATIONS
    # 2.3 to 2.7:
    add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
    add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );

    # 2.8 to 3.0:
    remove_action( 'wp_version_check', 'wp_version_check' );
    remove_action( 'admin_init', '_maybe_update_core' );
    add_filter( 'pre_transient_update_core', create_function( '$a', "return null;" ) );

    # 3.0:
    add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );

    # REMOVE PLUGIN UPDATE NOTIFICATIONS
    # 2.3 to 2.7:
    add_action( 'admin_menu', create_function( '$a', "remove_action( 'load-plugins.php', 'wp_update_plugins' );") );
    # Why use the admin_menu hook? It's the only one available between the above hook being added and being applied
    add_action( 'admin_init', create_function( '$a', "remove_action( 'admin_init', 'wp_update_plugins' );"), 2 );
    add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_update_plugins' );"), 2 );
    add_filter( 'pre_option_update_plugins', create_function( '$a', "return null;" ) );

    # 2.8 to 3.0:
    remove_action( 'load-plugins.php', 'wp_update_plugins' );
    remove_action( 'load-update.php', 'wp_update_plugins' );
    remove_action( 'admin_init', '_maybe_update_plugins' );
    remove_action( 'wp_update_plugins', 'wp_update_plugins' );
    add_filter( 'pre_transient_update_plugins', create_function( '$a', "return null;" ) );

    # 3.0:
    remove_action( 'load-update-core.php', 'wp_update_plugins' );
    add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" );
    29 changes: 29 additions & 0 deletions Remove admin items
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    function remove_admin_menu_items () {
    if (function_exists( 'remove_menu_page' ) && current_user_can( 'editor' )) {
    remove_menu_page( 'acf-options' );
    remove_menu_page( 'edit.php?post_type=acf' );
    remove_menu_page( 'pods' );
    remove_menu_page( 'wpcf7' );
    remove_menu_page( 'options-general.php' );
    remove_submenu_page( 'themes.php', 'themes.php' );
    }
    }
    add_action( 'admin_menu', 'remove_admin_menu_items', 999 );

    function remove_dashboard_widgets() {
    remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_browser_nag', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
    }

    add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );

    function remove_admin_bar_items() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('comments');
    $wp_admin_bar->remove_menu('updates');
    $wp_admin_bar->remove_menu('new-content');
    }
    add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_items' );
    14 changes: 14 additions & 0 deletions Show custom admin message
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    function showMessage($message, $errormsg = false) {
    if ($errormsg) {
    echo '<div id="message" class="error">';
    }
    else {
    echo '<div id="message" class="updated fade">';
    }
    echo "<p><strong>$message</strong></p></div>";
    }

    function showAdminMessages() {
    showMessage("Working on Theme's function.php, Do not touch it till further notice.", true);
    }
    add_action('admin_notices', 'showAdminMessages');