tweaks.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. remove_action('wp_head', 'index_rel_link' );
  3. remove_action('wp_head', 'rel_canonical');
  4. remove_action('wp_head', 'start_post_rel_link', 10, 0 );
  5. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
  6. remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );
  7. remove_action('wp_head', 'parent_post_rel_link', 10, 0 );
  8. remove_action('wp_head', 'rsd_link');
  9. remove_action('wp_head', 'wlwmanifest_link');
  10. remove_action('wp_head', 'wp_generator');
  11. remove_action('wp_head', 'feed_links_extra', 3 );
  12. remove_action('wp_head', 'feed_links', 2 );
  13. remove_action('wp_head', 'wp_oembed_add_discovery_links', 10, 0 );
  14. remove_action( 'wp_head', 'wp_oembed_add_host_js', 10, 0 );
  15. function cc_remove_wp_ver_css_js( $src ) {
  16. if ( strpos( $src, 'ver=' ) )
  17. $src = remove_query_arg( 'ver', $src );
  18. return $src;
  19. }
  20. add_filter( 'style_loader_src', 'cc_remove_wp_ver_css_js', 9999 );
  21. add_filter( 'script_loader_src', 'cc_remove_wp_ver_css_js', 9999 );
  22. add_filter( 'wpcf7_load_js', '__return_false' );
  23. add_filter( 'wpcf7_load_css', '__return_false' );
  24. add_action('wp_enqueue_scripts', 'add_wpcf7_scripts');
  25. function add_wpcf7_scripts() {
  26. if (is_page(array('contact', 'survey', 'service', 'estimate'))) {
  27. if (function_exists('wpcf7_enqueue_scripts')) {
  28. wpcf7_enqueue_scripts();
  29. wpcf7_enqueue_styles();
  30. }
  31. }
  32. }
  33. add_action( 'admin_head', 'cc_hide' );
  34. function cc_hide() {
  35. ?>
  36. <style type="text/css" media="screen">
  37. #footer {display:none;}
  38. #contextual-help-link-wrap {display: none;}
  39. #wpadminbar {display: none;}
  40. body.admin-bar #wpcontent, body.admin-bar #adminmenu {padding-top:0;}
  41. #wp-content-editor-tools{top:0 !important;position:relative!important;}
  42. #ed_toolbar{top:0px !important;}
  43. html.wp-toolbar{padding-top:0;}
  44. #postexcerpt p {display: none;}
  45. </style>
  46. <?php }
  47. function disable_emojis_tinymce( $plugins ) {
  48. if ( is_array( $plugins ) ) {
  49. return array_diff( $plugins, array( 'wpemoji' ) );
  50. } else {
  51. return array();
  52. }
  53. }
  54. function disable_emojis() {
  55. remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
  56. remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
  57. remove_action( 'wp_print_styles', 'print_emoji_styles' );
  58. remove_action( 'admin_print_styles', 'print_emoji_styles' );
  59. remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
  60. remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
  61. remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
  62. add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
  63. }
  64. add_action( 'init', 'disable_emojis' );