functions.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. if ( ! function_exists( 'dw_setup' ) ):
  3. function dw_setup() {
  4. require( get_template_directory() . '/inc/template.php' );
  5. }
  6. endif;
  7. add_action( 'after_setup_theme', 'dw_setup' );
  8. remove_action('wp_head', 'index_rel_link' );
  9. remove_action('wp_head', 'rel_canonical');
  10. remove_action('wp_head', 'start_post_rel_link', 10, 0 );
  11. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
  12. remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );
  13. remove_action('wp_head', 'parent_post_rel_link', 10, 0 );
  14. remove_action('wp_head', 'rsd_link');
  15. remove_action('wp_head', 'wlwmanifest_link');
  16. remove_action('wp_head', 'wp_generator');
  17. remove_action('wp_head', 'feed_links_extra', 3 );
  18. remove_action('wp_head', 'feed_links', 2 );
  19. add_editor_style();
  20. add_theme_support( 'post-thumbnails' );
  21. set_post_thumbnail_size( 150, 150, true );
  22. add_image_size( 'post-large', 770, 577, true );
  23. add_theme_support( 'automatic-feed-links' );
  24. add_theme_support( 'menus' );
  25. function dw_remove_wp_ver_css_js( $src ) {
  26. if ( strpos( $src, 'ver=' ) )
  27. $src = remove_query_arg( 'ver', $src );
  28. return $src;
  29. }
  30. add_filter( 'style_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
  31. add_filter( 'script_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
  32. add_action( 'admin_head', 'dw_hide' );
  33. function dw_hide() {
  34. ?>
  35. <style type="text/css" media="screen">
  36. #footer {display:none;}
  37. #contextual-help-link-wrap {display: none;}
  38. #wpadminbar {display: none;}
  39. body.admin-bar #wpcontent, body.admin-bar #adminmenu {padding-top:0;}
  40. html.wp-toolbar{padding-top:0;}
  41. #postexcerpt p {display: none;}
  42. </style>
  43. <?php }
  44. add_action( 'wp_enqueue_scripts', 'dw_scripts' );
  45. function dw_scripts() {
  46. global $post;
  47. wp_deregister_script('jquery');
  48. wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), false, true);
  49. wp_enqueue_script( 'jquery', '', '', '', true );
  50. wp_enqueue_style( 'style', get_stylesheet_uri() );
  51. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  52. wp_enqueue_script( 'comment-reply' );
  53. }
  54. }
  55. ?>