tweaks.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. function phf_fromemail($email) {
  3. //$wpfrom = get_option('admin_email');
  4. //return $wpfrom;
  5. return 'david@phfilms.com';
  6. }
  7. function phf_fromname($email){
  8. //$wpfrom = get_option('blogname');
  9. //return $wpfrom;
  10. return 'PHFilms.com';
  11. }
  12. add_filter('wp_mail_from', 'phf_fromemail');
  13. add_filter('wp_mail_from_name', 'phf_fromname');
  14. function _ph_page_menu_args( $args ) {
  15. $args['show_home'] = true;
  16. return $args;
  17. }
  18. add_filter( 'wp_page_menu_args', '_ph_page_menu_args' );
  19. function _ph_body_classes( $classes ) {
  20. // Adds a class of group-blog to blogs with more than 1 published author
  21. if ( is_multi_author() ) {
  22. $classes[] = 'group-blog';
  23. }
  24. return $classes;
  25. }
  26. add_filter( 'body_class', '_ph_body_classes' );
  27. function _ph_enhanced_image_navigation( $url, $id ) {
  28. if ( ! is_attachment() && ! wp_attachment_is_image( $id ) )
  29. return $url;
  30. $image = get_post( $id );
  31. if ( ! empty( $image->post_parent ) && $image->post_parent != $id )
  32. $url .= '#main';
  33. return $url;
  34. }
  35. add_filter( 'attachment_link', '_ph_enhanced_image_navigation', 10, 2 );
  36. function disable_emojis_tinymce( $plugins ) {
  37. if ( is_array( $plugins ) ) {
  38. return array_diff( $plugins, array( 'wpemoji' ) );
  39. } else {
  40. return array();
  41. }
  42. }
  43. function disable_emojis() {
  44. remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
  45. remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
  46. remove_action( 'wp_print_styles', 'print_emoji_styles' );
  47. remove_action( 'admin_print_styles', 'print_emoji_styles' );
  48. remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
  49. remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
  50. remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
  51. add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
  52. }
  53. add_action( 'init', 'disable_emojis' );
  54. add_action('init', 'ph_head_cleanup');
  55. function ph_head_cleanup() {
  56. remove_action('wp_head', 'feed_links');
  57. remove_action('wp_head', 'feed_links', 2 );
  58. remove_action('wp_head', 'feed_links_extra');
  59. remove_action('wp_head', 'feed_links_extra', 3 );
  60. remove_action('wp_head', 'rsd_link');
  61. remove_action('wp_head', 'wlwmanifest_link');
  62. remove_action('wp_head', 'index_rel_link');
  63. remove_action('wp_head', 'parent_post_rel_link');
  64. remove_action('wp_head', 'start_post_rel_link');
  65. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
  66. remove_action('wp_head', 'wp_generator');
  67. remove_action('wp_head', 'wp_shortlink_wp_head');
  68. remove_action('wp_head', 'rel_canonical');
  69. }
  70. add_action('admin_menu', 'remove_menus');
  71. function remove_menus () {
  72. global $menu;
  73. // $restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
  74. $restricted = array();
  75. end ($menu);
  76. while (prev($menu)){
  77. $value = explode(' ',$menu[key($menu)][0]);
  78. if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
  79. }
  80. }
  81. add_action('login_head', 'phf_login_logo');
  82. function phf_login_logo() {
  83. echo '<style type="text/css">
  84. .login h1 a { background-image:url('.get_bloginfo('template_directory').'/img/phf_login.png) !important; width: 326px;background-size:326px 67px;}
  85. </style>';
  86. }
  87. //add_action( 'admin_head', 'phf_hide' );
  88. function phf_hide() {
  89. ?>
  90. <style type="text/css" media="screen">
  91. #footer {display:none;}
  92. /* #screen-meta-links {display: none;} */
  93. #wpadminbar {display: none;}
  94. body.admin-bar #wpcontent, body.admin-bar #adminmenu {padding-top:0;}
  95. html.wp-toolbar{padding-top:0;}
  96. #postexcerpt p {display: none;}
  97. </style>
  98. <?php }
  99. add_filter( 'script_loader_src', 'remove_src_version' );
  100. add_filter( 'style_loader_src', 'remove_src_version' );
  101. function remove_src_version ( $src ) {
  102. global $wp_version;
  103. $version_str = '?ver='.$wp_version;
  104. $version_str_offset = strlen( $src ) - strlen( $version_str );
  105. if( substr( $src, $version_str_offset ) == $version_str )
  106. return substr( $src, 0, $version_str_offset );
  107. else
  108. return $src;
  109. }
  110. add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
  111. function remove_dashboard_widgets(){
  112. global$wp_meta_boxes;
  113. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  114. //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
  115. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  116. //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  117. //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  118. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  119. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
  120. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
  121. }
  122. function ph_rss_output(){
  123. echo '<div class="rss-widget">';
  124. wp_widget_rss_output(array(
  125. 'url' => 'http://phfilms.com/feed/',
  126. 'title' => 'PHFilms.com',
  127. 'items' => 4,
  128. 'show_summary' => 1,
  129. 'show_author' => 0,
  130. 'show_date' => 1
  131. ));
  132. echo "</div>";
  133. }
  134. add_action('wp_dashboard_setup', 'ph_rss_widget');
  135. function ph_rss_widget(){
  136. wp_add_dashboard_widget( 'ph-rss', 'PHFilms', 'ph_rss_output');
  137. }
  138. function ph_editor_styles() {
  139. add_editor_style( 'style.css' );
  140. }
  141. //add_action( 'init', 'ph_editor_styles' );
  142. ?>