functions.php 5.5 KB

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