functions.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. add_action( 'wp_enqueue_scripts', 'twenty_five_enqueue_styles' );
  3. function twenty_five_enqueue_styles() {
  4. wp_enqueue_style(
  5. '2025-style',
  6. get_parent_theme_file_uri( 'style.css' )
  7. );
  8. }
  9. add_filter('gettext', 'srh25_change_howdy', 10, 3);
  10. function srh25_change_howdy($translated, $text, $domain) {
  11. if (false !== strpos($translated, 'Howdy,'))
  12. return str_replace('Howdy,', '', $translated);
  13. return $translated;
  14. }
  15. add_filter( 'gettext', 'srh25_change_howdy_text_email', 10, 2 );
  16. function srh25_change_howdy_text_email( $translation, $original ) {
  17. if( 'Howdy, %1$s' == $original )
  18. $translation = '%1$s';
  19. return $translation;
  20. }
  21. add_filter( 'show_admin_bar', '__return_false' );
  22. add_action( 'admin_bar_menu', 'srh25_admin_bar', 999 );
  23. function srh25_admin_bar( $wp_admin_bar ) {
  24. //$wp_admin_bar->remove_menu('my-account');
  25. //$wp_admin_bar->remove_menu( 'edit' );
  26. //$wp_admin_bar->remove_menu('site-name');
  27. $wp_admin_bar->remove_node('wp-logo');
  28. $wp_admin_bar->remove_node('themes');
  29. $wp_admin_bar->remove_node('widgets');
  30. $wp_admin_bar->remove_node('menus');
  31. $wp_admin_bar->remove_node('new-media');
  32. $wp_admin_bar->remove_menu('edit-profile');
  33. $wp_admin_bar->remove_menu('comments');
  34. $wp_admin_bar->remove_menu('about');
  35. $wp_admin_bar->remove_menu('wporg');
  36. $wp_admin_bar->remove_menu('documentation');
  37. $wp_admin_bar->remove_menu('support-forums');
  38. $wp_admin_bar->remove_menu('feedback');
  39. $wp_admin_bar->remove_menu('customize');
  40. $wp_admin_bar->remove_menu('view-site');
  41. $wp_admin_bar->remove_menu('updates');
  42. $wp_admin_bar->remove_menu('comments');
  43. $wp_admin_bar->remove_menu('new-content');
  44. $wp_admin_bar->remove_menu('view');
  45. }
  46. add_action( 'admin_init', 'srh25_remove_dashboard_meta' );
  47. function srh25_remove_dashboard_meta() {
  48. remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
  49. remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
  50. remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
  51. remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
  52. remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
  53. remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
  54. }
  55. add_action( 'admin_head-profile.php', 'srh25_remove_admin_color' );
  56. function srh25_remove_admin_color() {
  57. remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
  58. }
  59. add_filter('admin_footer_text', 'srh25_remove_admin_footer_text', 1000);
  60. function srh25_remove_admin_footer_text(){return '';}
  61. add_filter('update_footer', 'srh25_remove_admin_footer_upgrade', 1000);
  62. function srh25_remove_admin_footer_upgrade(){return '';}
  63. add_filter( 'login_headerurl', 'srh25_login_logo_url' );
  64. function srh25_login_logo_url() {
  65. return home_url();
  66. }
  67. add_filter( 'login_headertext', 'srh25_login_url_title' );
  68. function srh25_login_url_title() {
  69. return 'SRH Physicians';
  70. }
  71. add_action( 'login_enqueue_scripts', 'srh25_login_logo' );
  72. function srh25_login_logo() { ?>
  73. <style type="text/css">
  74. .login h1 a {
  75. background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/disc.png) !important;
  76. padding-bottom: 30px;
  77. }
  78. .wp-core-ui .button-primary {
  79. background: #4FB54F;
  80. border-color: #027643;
  81. }
  82. .login .message {
  83. border-left: 4px solid #027643;
  84. }
  85. .login form .forgetmenot label {
  86. display:none;
  87. }
  88. .login #backtoblog a {
  89. display:none;
  90. }
  91. </style>
  92. <?php }
  93. // Allow SVG
  94. add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
  95. global $wp_version;
  96. if ( $wp_version !== '4.7.1' ) {
  97. return $data;
  98. }
  99. $filetype = wp_check_filetype( $filename, $mimes );
  100. return [
  101. 'ext' => $filetype['ext'],
  102. 'type' => $filetype['type'],
  103. 'proper_filename' => $data['proper_filename']
  104. ];
  105. }, 10, 4 );
  106. add_action( 'admin_head', 'fix_svg' );
  107. function cc_mime_types( $mimes ){
  108. $mimes['svg'] = 'image/svg+xml';
  109. return $mimes;
  110. }
  111. add_filter( 'upload_mimes', 'cc_mime_types' );
  112. function fix_svg() {
  113. echo '<style type="text/css">
  114. .attachment-266x266, .thumbnail img {
  115. width: 100% !important;
  116. height: auto !important;
  117. }
  118. </style>';
  119. }
  120. function add_edit_link() {
  121. ob_start();
  122. 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' );
  123. return ob_get_clean();
  124. }
  125. add_action( 'init', 'add_edit_link_shortcode' );
  126. function add_edit_link_shortcode() {
  127. add_shortcode( 'edit-link', 'add_edit_link' );
  128. }