|
@@ -0,0 +1,273 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+************************************************************/
|
|
|
+require get_theme_file_path( '/inc/smtp.php' );
|
|
|
+
|
|
|
+
|
|
|
+function wpmu_list_sites() {
|
|
|
+ $subsites = get_sites();
|
|
|
+ if ( ! empty ( $subsites ) ) {
|
|
|
+ echo '<ul class="subsites">';
|
|
|
+ foreach( $subsites as $subsite ) {
|
|
|
+ $subsite_id = get_object_vars( $subsite )["blog_id"];
|
|
|
+ $subsite_name = get_blog_details( $subsite_id )->blogname;
|
|
|
+ $subsite_link = get_blog_details( $subsite_id )->siteurl;
|
|
|
+ echo '<li class="site-' . $subsite_id . '"><a href="' . $subsite_link . '">' . $subsite_name . '</a></li>';
|
|
|
+ }
|
|
|
+ echo '</ul>';
|
|
|
+ }
|
|
|
+}
|
|
|
+function hbr_global_menu() {
|
|
|
+ if (!in_array(get_current_blog_id(), array(2))){
|
|
|
+ switch_to_blog( '1' );
|
|
|
+ if (is_nav_menu(8)){
|
|
|
+ wp_nav_menu( ['menu' => '8', 'menu_class' => 'hbr-global-menu',]);
|
|
|
+ }
|
|
|
+ restore_current_blog();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+function twentytwentyone_styles() {
|
|
|
+ wp_enqueue_style( 'child-style', get_stylesheet_uri(),
|
|
|
+ array( 'twenty-twenty-one-style' ), wp_get_theme()->get('Version') );
|
|
|
+}
|
|
|
+add_action( 'wp_enqueue_scripts', 'twentytwentyone_styles');
|
|
|
+
|
|
|
+function hbr_add_editor_styles() {
|
|
|
+ add_editor_style( 'style-editor.css' );
|
|
|
+}
|
|
|
+add_action( 'admin_init', 'hbr_add_editor_styles' );
|
|
|
+
|
|
|
+function hbr_theme_setup() {
|
|
|
+ add_theme_support( 'align-wide' );
|
|
|
+ add_theme_support( 'editor-color-palette', array (
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'black', 'hbr' ),
|
|
|
+ 'slug' => 'black',
|
|
|
+ 'color' => '#000000',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'white', 'hbr' ),
|
|
|
+ 'slug' => 'white',
|
|
|
+ 'color' => '#ffffff',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'dark grey', 'hbr' ),
|
|
|
+ 'slug' => 'darkgrey',
|
|
|
+ 'color' => '#8F887B',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'blue grey', 'hbr' ),
|
|
|
+ 'slug' => 'bluegrey',
|
|
|
+ 'color' => '#303740',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'brown grey', 'hbr' ),
|
|
|
+ 'slug' => 'browngrey',
|
|
|
+ 'color' => '#3d3d3d',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'brown', 'hbr' ),
|
|
|
+ 'slug' => 'brown',
|
|
|
+ 'color' => '#5C584F',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'dark brown', 'hbr' ),
|
|
|
+ 'slug' => 'darkbrown',
|
|
|
+ 'color' => '#4F4E4C',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'paper', 'hbr' ),
|
|
|
+ 'slug' => 'paper',
|
|
|
+ 'color' => '#DBD8D3',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'tan', 'hbr' ),
|
|
|
+ 'slug' => 'tan',
|
|
|
+ 'color' => '#BDB3A2',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'med grey', 'hbr' ),
|
|
|
+ 'slug' => 'medgrey',
|
|
|
+ 'color' => '#7A7A7A',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'light blue', 'hbr' ),
|
|
|
+ 'slug' => 'lightblue',
|
|
|
+ 'color' => '#6D7F8F',
|
|
|
+ ),
|
|
|
+ array(
|
|
|
+ 'name' => esc_attr__( 'grey', 'hbr' ),
|
|
|
+ 'slug' => 'grey',
|
|
|
+ 'color' => '#B8BCBF',
|
|
|
+ ),
|
|
|
+ ));
|
|
|
+}
|
|
|
+add_action( 'after_setup_theme', 'hbr_theme_setup', 30 );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+remove_action('wp_head', 'index_rel_link' );
|
|
|
+remove_action('wp_head', 'rel_canonical');
|
|
|
+remove_action('wp_head', 'start_post_rel_link', 10);
|
|
|
+remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);
|
|
|
+remove_action('wp_head', 'wp_shortlink_wp_head', 10);
|
|
|
+remove_action('wp_head', 'parent_post_rel_link', 10);
|
|
|
+remove_action('wp_head', 'rsd_link');
|
|
|
+remove_action('wp_head', 'wlwmanifest_link');
|
|
|
+remove_action('wp_head', 'wp_generator');
|
|
|
+remove_action('wp_head', 'feed_links_extra', 3 );
|
|
|
+remove_action('wp_head', 'feed_links', 2 );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+add_filter( 'style_loader_src', 'hbr_remove_wp_ver_css_js', 9999 );
|
|
|
+function hbr_remove_wp_ver_css_js( $src ) {
|
|
|
+ if ( strpos( $src, 'ver=' ) )
|
|
|
+ $src = remove_query_arg( 'ver', $src );
|
|
|
+ return $src;
|
|
|
+}
|
|
|
+
|
|
|
+add_filter( 'xmlrpc_enabled', '__return_false' );
|
|
|
+add_filter( 'wp_headers', 'hbr_disable_x_pingback' );
|
|
|
+function hbr_disable_x_pingback( $headers ) {
|
|
|
+ unset( $headers['X-Pingback'] );
|
|
|
+ return $headers;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+remove_action('welcome_panel', 'wp_welcome_panel');
|
|
|
+
|
|
|
+add_action('admin_head', 'hbr_remove_help_tabs');
|
|
|
+function hbr_remove_help_tabs() {
|
|
|
+ $screen = get_current_screen();
|
|
|
+ $screen->remove_help_tabs();
|
|
|
+}
|
|
|
+add_action( 'admin_init', 'hbr_remove_dashboard_meta' );
|
|
|
+function hbr_remove_dashboard_meta() {
|
|
|
+ remove_meta_box( 'wp_mail_smtp_reports_widget_lite', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
|
|
|
+ remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+add_action( 'admin_menu', 'hbr_remove_admin_pages', 99 );
|
|
|
+function hbr_remove_admin_pages() {
|
|
|
+ remove_menu_page( 'edit-comments.php' );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+add_filter('show_admin_bar', '__return_false');
|
|
|
+add_filter('show_recent_comments_widget_style', function() { return false; });
|
|
|
+
|
|
|
+add_action( 'admin_bar_menu', 'hbr_remove_adminbar', 999 );
|
|
|
+function hbr_remove_adminbar( $wp_admin_bar ) {
|
|
|
+ $wp_admin_bar->remove_node( 'wp-logo' );
|
|
|
+ $wp_admin_bar->remove_node( 'updates' );
|
|
|
+ $wp_admin_bar->remove_menu( 'comments' );
|
|
|
+ $wp_admin_bar->remove_menu( 'customize' );
|
|
|
+ $wp_admin_bar->remove_menu( 'new-content' );
|
|
|
+ $wp_admin_bar->remove_menu( 'edit' );
|
|
|
+ $wp_admin_bar->remove_menu( 'new-user' );
|
|
|
+ $wp_admin_bar->remove_menu( 'new-post' );
|
|
|
+ $wp_admin_bar->remove_menu( 'new-page' );
|
|
|
+ $wp_admin_bar->remove_node( 'new-media' );
|
|
|
+ $wp_admin_bar->remove_menu( 'comments' );
|
|
|
+ $wp_admin_bar->remove_node( 'view-site' );
|
|
|
+ $wp_admin_bar->remove_menu( 'edit-profile' );
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+add_filter('admin_footer_text', '__return_empty_string', 1000);
|
|
|
+add_filter('update_footer', '__return_empty_string', 1000);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+**************************************************/
|
|
|
+add_filter( 'gettext', 'hbr_change_howdy_text', 10, 2 );
|
|
|
+function hbr_change_howdy_text( $translation, $original ) {
|
|
|
+ if( 'Howdy, %1$s' == $original )
|
|
|
+ $translation = '%1$s';
|
|
|
+ return $translation;
|
|
|
+}
|
|
|
+add_filter( 'admin_bar_menu', 'hbr_replace_howdy', 25 );
|
|
|
+function hbr_replace_howdy( $wp_admin_bar ) {
|
|
|
+ $my_account = $wp_admin_bar->get_node('my-account');
|
|
|
+ $newtext = str_replace( 'Howdy,', '', $my_account->title );
|
|
|
+ $wp_admin_bar->add_node( array(
|
|
|
+ 'id' => 'my-account',
|
|
|
+ 'title' => $newtext,
|
|
|
+ ) );
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+************************************************************/
|
|
|
+
|
|
|
+add_action( 'wp_login', 'hbr_login_timestamp', 20, 2 );
|
|
|
+function hbr_login_timestamp( $user_login, $user ) {
|
|
|
+ update_user_meta( $user->ID, 'last_login', time() );
|
|
|
+}
|
|
|
+add_filter( 'manage_users_columns', 'hbr_user_last_login_column' );
|
|
|
+function hbr_user_last_login_column( $columns ) {
|
|
|
+ $columns['last_login'] = 'Last Login';
|
|
|
+ return $columns;
|
|
|
+}
|
|
|
+add_filter( 'manage_users_custom_column', 'hbr_last_login_column', 10, 3 );
|
|
|
+function hbr_last_login_column( $output, $column_id, $user_id ){
|
|
|
+ if( $column_id == 'last_login' ) {
|
|
|
+ $last_login = get_user_meta( $user_id, 'last_login', true );
|
|
|
+ $date_format = 'j M, Y';
|
|
|
+ $output = $last_login ? date( $date_format, $last_login ) : '-';
|
|
|
+ }
|
|
|
+ return $output;
|
|
|
+}
|
|
|
+add_filter( 'manage_users_sortable_columns', 'hbr_sortable_columns' );
|
|
|
+function hbr_sortable_columns( $columns ) {
|
|
|
+ return wp_parse_args( array(
|
|
|
+ 'last_login' => 'last_login'
|
|
|
+ ), $columns );
|
|
|
+}
|
|
|
+add_action( 'pre_get_users', 'hbr_sort_last_login_column' );
|
|
|
+function hbr_sort_last_login_column( $query ) {
|
|
|
+ if( !is_admin() ) { return; }
|
|
|
+ $orderby = $query->get('orderby');
|
|
|
+ if( 'last_login' == $orderby ) {
|
|
|
+ $query->set('meta_key','last_login');
|
|
|
+ $query->set('orderby','meta_value');
|
|
|
+ }
|
|
|
+ return $query;
|
|
|
+}
|
|
|
+add_filter( 'wpmu_users_columns', 'hbr_user_last_login_column' );
|