tweaks.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. function dw_remove_wp_ver_css_js( $src ) {
  14. if ( strpos( $src, 'ver=' ) )
  15. $src = remove_query_arg( 'ver', $src );
  16. return $src;
  17. }
  18. add_filter( 'style_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
  19. add_filter( 'script_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
  20. add_action( 'admin_head', 'dw_hide' );
  21. function dw_hide() {
  22. ?>
  23. <style type="text/css" media="screen">
  24. #footer {display:none;}
  25. #contextual-help-link-wrap {display: none;}
  26. #wpadminbar {display: none;}
  27. body.admin-bar #wpcontent, body.admin-bar #adminmenu {padding-top:0;}
  28. html.wp-toolbar{padding-top:0;}
  29. #postexcerpt p {display: none;}
  30. </style>
  31. <?php }
  32. add_filter('wp_mail_from', 'dw_fromemail');
  33. function dw_fromemail($email) {
  34. $wpfrom = get_option('admin_email');
  35. return $wpfrom;
  36. }
  37. add_filter('wp_mail_from_name', 'dw_fromname');
  38. function dw_fromname($email){
  39. $wpfrom = get_option('blogname');
  40. return $wpfrom;
  41. }
  42. add_filter( 'embed_oembed_html', 'dw_oembed_filter', 10, 4 ) ;
  43. function dw_oembed_filter($html, $url, $attr, $post_ID) {
  44. $return = '<div class="video-container">'.$html.'</div>';
  45. $return = str_replace('frameborder="0" allowfullscreen', 'style="border:none"', $return);
  46. return $return;
  47. }
  48. add_filter( 'embed_oembed_html', 'dw_embed_oembed_html' );
  49. function dw_embed_oembed_html( $html ) {
  50. return preg_replace( '@src="https?:@', 'src="', $html );
  51. }
  52. add_filter("gform_field_content", "bootstrap_gravityforms", 10, 5);
  53. function bootstrap_gravityforms($content, $field, $value, $lead_id, $form_id){
  54. if($field["type"] != 'hidden' && $field["type"] != 'list' && $field["type"] != 'multiselect' && $field["type"] != 'checkbox' && $field["type"] != 'fileupload' && $field["type"] != 'date' && $field["type"] != 'html' && $field["type"] != 'address') {
  55. $content = str_replace('class=\'medium', 'class=\'form-control medium', $content);
  56. }
  57. if($field["type"] == 'name' || $field["type"] == 'address') {
  58. $content = str_replace('<input ', '<input class=\'form-control\' ', $content);
  59. }
  60. if($field["type"] == 'textarea') {
  61. $content = str_replace('class=\'textarea', 'class=\'form-control textarea', $content);
  62. }
  63. if($field["type"] == 'checkbox') {
  64. $content = str_replace('li class=\'', 'li class=\'checkbox ', $content);
  65. $content = str_replace('<input ', '<input style=\'margin-left:1px;\' ', $content);
  66. }
  67. if($field["type"] == 'radio') {
  68. $content = str_replace('li class=\'', 'li class=\'radio ', $content);
  69. $content = str_replace('<input ', '<input style=\'margin-left:1px;\' ', $content);
  70. }
  71. return $content;
  72. }
  73. add_filter("gform_init_scripts_footer", "init_gscripts");
  74. function init_gscripts() {
  75. return true;
  76. }
  77. add_action( 'wp_print_scripts', 'dw_deregister_javascript', 100 );
  78. function dw_deregister_javascript() {
  79. wp_deregister_script( 'gform_conditional_logic' );
  80. //wp_deregister_script( 'gform_json' );
  81. wp_deregister_script( 'gforms_stripe_frontend' );
  82. //wp_deregister_script( 'gform_gravityforms' );
  83. }
  84. ?>