tweaks.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. add_action('init', 'ph_head_cleanup');
  37. function ph_head_cleanup() {
  38. remove_action('wp_head', 'feed_links');
  39. remove_action('wp_head', 'feed_links', 2 );
  40. remove_action('wp_head', 'feed_links_extra');
  41. remove_action('wp_head', 'feed_links_extra', 3 );
  42. remove_action('wp_head', 'rsd_link');
  43. remove_action('wp_head', 'wlwmanifest_link');
  44. remove_action('wp_head', 'index_rel_link');
  45. remove_action('wp_head', 'parent_post_rel_link');
  46. remove_action('wp_head', 'start_post_rel_link');
  47. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
  48. remove_action('wp_head', 'wp_generator');
  49. remove_action('wp_head', 'wp_shortlink_wp_head');
  50. remove_action('wp_head', 'rel_canonical');
  51. }
  52. add_action('admin_menu', 'remove_menus');
  53. function remove_menus () {
  54. global $menu;
  55. // $restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
  56. $restricted = array();
  57. end ($menu);
  58. while (prev($menu)){
  59. $value = explode(' ',$menu[key($menu)][0]);
  60. if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
  61. }
  62. }
  63. add_action('login_head', 'phf_login_logo');
  64. function phf_login_logo() {
  65. echo '<style type="text/css">
  66. .login h1 a { background-image:url('.get_bloginfo('template_directory').'/img/phf_login.png) !important; width: 326px;background-size:326px 67px;}
  67. </style>';
  68. }
  69. add_action( 'admin_head', 'phf_hide' );
  70. function phf_hide() {
  71. ?>
  72. <style type="text/css" media="screen">
  73. #footer {display:none;}
  74. /* #screen-meta-links {display: none;} */
  75. #wpadminbar {display: none;}
  76. body.admin-bar #wpcontent, body.admin-bar #adminmenu {padding-top:0;}
  77. html.wp-toolbar{padding-top:0;}
  78. #postexcerpt p {display: none;}
  79. </style>
  80. <?php }
  81. add_filter( 'script_loader_src', 'remove_src_version' );
  82. add_filter( 'style_loader_src', 'remove_src_version' );
  83. function remove_src_version ( $src ) {
  84. global $wp_version;
  85. $version_str = '?ver='.$wp_version;
  86. $version_str_offset = strlen( $src ) - strlen( $version_str );
  87. if( substr( $src, $version_str_offset ) == $version_str )
  88. return substr( $src, 0, $version_str_offset );
  89. else
  90. return $src;
  91. }
  92. add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
  93. function remove_dashboard_widgets(){
  94. global$wp_meta_boxes;
  95. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  96. //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
  97. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  98. //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  99. //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  100. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  101. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
  102. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
  103. }
  104. function ph_rss_output(){
  105. echo '<div class="rss-widget">';
  106. wp_widget_rss_output(array(
  107. 'url' => 'http://phfilms.com/feed/',
  108. 'title' => 'PHFilms.com',
  109. 'items' => 4,
  110. 'show_summary' => 1,
  111. 'show_author' => 0,
  112. 'show_date' => 1
  113. ));
  114. echo "</div>";
  115. }
  116. add_action('wp_dashboard_setup', 'ph_rss_widget');
  117. function ph_rss_widget(){
  118. wp_add_dashboard_widget( 'ph-rss', 'PHFilms', 'ph_rss_output');
  119. }