Posted By

ethicka on 09/01/11


Tagged

wordpress theme functionsphp


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Kurt
logik42


WordPress functions.php Boilerplate


 / Published in: PHP
 

I use this to toss all the junk from the header, add a favicon, remove useless admin elements, and block WordPress' ancient jQuery file from embedding.

  1. <?php
  2. if (!is_admin()) wp_deregister_script('jquery');
  3. wp_deregister_script('l10n');
  4. if (function_exists('automatic_feed_links')) {
  5. automatic_feed_links();
  6. } else {
  7. return;
  8. }
  9. remove_action('wp_head', 'rsd_link');
  10. remove_action('wp_head', 'wp_generator');
  11. remove_action('wp_head', 'feed_links', 2);
  12. remove_action('wp_head', 'index_rel_link');
  13. remove_action('wp_head', 'wlwmanifest_link');
  14. remove_action('wp_head', 'feed_links_extra', 3);
  15. remove_action('wp_head', 'start_post_rel_link', 10, 0);
  16. remove_action('wp_head', 'parent_post_rel_link', 10, 0);
  17. remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
  18. function blog_favicon() {
  19. echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('wpurl').'/favicon.ico" />';
  20. }
  21. add_action('wp_head', 'blog_favicon');
  22. function theme_admin_bar_render() {
  23. global $wp_admin_bar;
  24. $wp_admin_bar->remove_menu('comments');
  25. $wp_admin_bar->remove_menu('appearance');
  26. }
  27. add_action( 'wp_before_admin_bar_render', 'theme_admin_bar_render' );

Report this snippet  

You need to login to post a comment.