Browse Source

srh-edit 🔥

David Windham 1 month ago
commit
6686fc5215
6 changed files with 243 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 149 0
      functions.php
  3. BIN
      img/disc.png
  4. BIN
      screenshot.png
  5. 8 0
      style.css
  6. 85 0
      theme.json

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.DS_Store

+ 149 - 0
functions.php

@@ -0,0 +1,149 @@
+<?php 
+
+add_action( 'wp_enqueue_scripts', 'twenty_five_enqueue_styles' );
+function twenty_five_enqueue_styles() {
+	wp_enqueue_style( 
+		'2025-style', 
+		get_parent_theme_file_uri( 'style.css' )
+	);
+}
+
+add_filter('gettext', 'srh25_change_howdy', 10, 3);
+function srh25_change_howdy($translated, $text, $domain) {
+    if (false !== strpos($translated, 'Howdy,'))
+        return str_replace('Howdy,', '', $translated);
+    return $translated;
+}
+
+add_filter( 'gettext', 'srh25_change_howdy_text_email', 10, 2 );
+function srh25_change_howdy_text_email( $translation, $original ) {
+    if( 'Howdy, %1$s' == $original )
+        $translation = '%1$s';
+    return $translation;
+}
+
+add_filter( 'show_admin_bar', '__return_false' );
+
+add_action( 'admin_bar_menu', 'srh25_admin_bar', 999 );
+function srh25_admin_bar( $wp_admin_bar ) {
+	//$wp_admin_bar->remove_menu('my-account');
+	//$wp_admin_bar->remove_menu( 'edit' );
+	//$wp_admin_bar->remove_menu('site-name');
+	$wp_admin_bar->remove_node('wp-logo');
+	$wp_admin_bar->remove_node('themes');
+	$wp_admin_bar->remove_node('widgets');
+	$wp_admin_bar->remove_node('menus');
+	$wp_admin_bar->remove_node('new-media');
+	$wp_admin_bar->remove_menu('edit-profile');
+	$wp_admin_bar->remove_menu('comments');
+	$wp_admin_bar->remove_menu('about');
+	$wp_admin_bar->remove_menu('wporg');
+	$wp_admin_bar->remove_menu('documentation');
+	$wp_admin_bar->remove_menu('support-forums');
+	$wp_admin_bar->remove_menu('feedback');
+	$wp_admin_bar->remove_menu('customize');
+	$wp_admin_bar->remove_menu('view-site');
+	$wp_admin_bar->remove_menu('updates');
+	$wp_admin_bar->remove_menu('comments');
+	$wp_admin_bar->remove_menu('new-content');
+  $wp_admin_bar->remove_menu('view');
+}
+
+add_action( 'admin_init', 'srh25_remove_dashboard_meta' );
+function srh25_remove_dashboard_meta() {
+  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_head-profile.php', 'srh25_remove_admin_color' );
+function srh25_remove_admin_color() {
+    remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+}
+
+add_filter('admin_footer_text', 'srh25_remove_admin_footer_text', 1000);
+function srh25_remove_admin_footer_text(){return '';}
+
+add_filter('update_footer', 'srh25_remove_admin_footer_upgrade', 1000);
+function srh25_remove_admin_footer_upgrade(){return '';}
+
+add_filter( 'login_headerurl', 'srh25_login_logo_url' );
+function srh25_login_logo_url() {
+    return home_url();
+}
+
+add_filter( 'login_headertext', 'srh25_login_url_title' );
+function srh25_login_url_title() {
+    return 'SRH Physicians';
+}
+
+add_action( 'login_enqueue_scripts', 'srh25_login_logo' );
+function srh25_login_logo() { ?>
+	<style type="text/css">
+	.login h1 a {
+			background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/disc.png) !important;
+			padding-bottom: 30px;
+	}
+	.wp-core-ui .button-primary {
+		background: #4FB54F;
+		border-color: #027643;
+	}
+	.login .message {
+		border-left: 4px solid #027643;
+	}
+	.login form .forgetmenot label {
+		display:none;
+	}
+	.login #backtoblog a {
+		display:none;
+	}
+	</style>
+<?php }
+
+
+// Allow SVG
+add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
+
+  global $wp_version;
+  if ( $wp_version !== '4.7.1' ) {
+     return $data;
+  }
+
+  $filetype = wp_check_filetype( $filename, $mimes );
+
+  return [
+      'ext'             => $filetype['ext'],
+      'type'            => $filetype['type'],
+      'proper_filename' => $data['proper_filename']
+  ];
+
+}, 10, 4 );
+
+add_action( 'admin_head', 'fix_svg' );
+function cc_mime_types( $mimes ){
+  $mimes['svg'] = 'image/svg+xml';
+  return $mimes;
+}
+add_filter( 'upload_mimes', 'cc_mime_types' );
+
+function fix_svg() {
+  echo '<style type="text/css">
+        .attachment-266x266, .thumbnail img {
+             width: 100% !important;
+             height: auto !important;
+        }
+        </style>';
+}
+  
+function add_edit_link() {
+  ob_start();
+  edit_post_link( __( 'Edit Page', 'textdomain' ), '<div class="wp-block-button">', '</div>', null, 'wp-block-button__link has-accent-2-background-color has-background wp-element-button' );
+  return ob_get_clean();
+}
+add_action( 'init', 'add_edit_link_shortcode' );
+function add_edit_link_shortcode() {
+  add_shortcode( 'edit-link', 'add_edit_link' );
+}

BIN
img/disc.png


BIN
screenshot.png


+ 8 - 0
style.css

@@ -0,0 +1,8 @@
+/**
+Theme Name: Edit SRH
+Template: twentytwentyfive
+Description: a theme to edit SRH
+Version: 1.0
+Author: windhamdavid
+Author URI: https://davidwindham.com
+*/

+ 85 - 0
theme.json

@@ -0,0 +1,85 @@
+{
+	"$schema": "https://schemas.wp.org/trunk/theme.json",
+	"version": 3,
+	"settings": {
+		"appearanceTools": true,
+		"color": {
+			"defaultDuotone": false,
+			"defaultGradients": false,
+			"defaultPalette": false,
+      "custom": false,
+			"palette": [
+				{
+					"color": "#ffffff",
+					"name": "Base",
+					"slug": "base"
+				},
+        {
+					"color": "#f1f1f1",
+					"name": "Off Base",
+					"slug": "off-base"
+				},
+				{
+					"color": "#a3b2ca",
+					"name": "Accent 1",
+					"slug": "accent-1"
+				},
+				{
+					"color": "#19458c",
+					"name": "Accent 2",
+					"slug": "accent-2"
+				},
+				{
+					"color": "#1d3863",
+					"name": "Accent 3",
+					"slug": "accent-3"
+				},
+				{
+					"color": "#1c2a40",
+					"name": "Accent 4",
+					"slug": "accent-4"
+				},
+				{
+					"color": "#dbe3e2",
+					"name": "Accent 5",
+					"slug": "accent-5"
+				},
+        {
+					"color": "#519c95",
+					"name": "Accent 6",
+					"slug": "accent-6"
+				},
+        {
+					"color": "#008578",
+					"name": "Accent 7",
+					"slug": "accent-7"
+				},
+        {
+					"color": "#d9b48f",
+					"name": "Accent 8",
+					"slug": "accent-8"
+				},
+        {
+					"color": "#870000",
+					"name": "Accent 9",
+					"slug": "accent-9"
+				},
+        {
+					"color": "#333333",
+					"name": "Accent 10",
+					"slug": "accent-10"
+				},
+        {
+					"color": "#0a0a0a",
+					"name": "Contrast",
+					"slug": "contrast"
+				},
+        {
+					"color": "color-mix(in srgb, currentColor 20%, transparent)",
+					"name": "Accent 6",
+					"slug": "accent-6"
+				}
+			]
+		}
+  }
+}