bones.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /* Welcome to Bones :)
  3. This is meant to be a very helpful development tool.
  4. I hope it makes your life easier!
  5. Developed by: Eddie Machado
  6. URL: http://themble.com/bones/
  7. */
  8. // remove some WP defaults
  9. function removeHeadLinks() {
  10. // remove simple discovery link
  11. remove_action('wp_head', 'rsd_link');
  12. // remove windows live writer link
  13. remove_action('wp_head', 'wlwmanifest_link');
  14. // remove the version number
  15. remove_action('wp_head', 'wp_generator');
  16. // remove header links
  17. }
  18. add_action('init', 'removeHeadLinks');
  19. // Add RSS links to <head> section
  20. automatic_feed_links();
  21. // loading jquery reply elements on single pages automatically
  22. function bones_queue_js(){
  23. if (!is_admin()){
  24. if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
  25. wp_enqueue_script( 'comment-reply' );
  26. }
  27. }
  28. add_action('wp_print_scripts', 'bones_queue_js');
  29. // Loading up the scripts in the footer
  30. function bones_jquery_scripts() { bones_comment_reply(); }
  31. add_filter('wp_footer','bones_jquery_scripts');
  32. // Adding WP 3.0 Functions
  33. //menus
  34. add_theme_support( 'menus' );
  35. // thumbnails
  36. add_theme_support('post-thumbnails');
  37. set_post_thumbnail_size(125, 125, true); /* more sizes are available using the functions.php file */
  38. // custom backgrounds
  39. add_custom_background();
  40. // header image
  41. define( 'HEADER_IMAGE', '%s/images/default-headbg.png' );
  42. define( 'HEADER_IMAGE_WIDTH', apply_filters( '', 960 ) ); // Width of Logo
  43. define( 'HEADER_IMAGE_HEIGHT', apply_filters( '', 150 ) ); // Height of Logo
  44. define( 'NO_HEADER_TEXT', true );
  45. add_custom_image_header( '', 'admin_header_style' );
  46. // Creating the Nav Menus
  47. function bones_menus() { register_nav_menus(
  48. array(
  49. 'main_nav' => 'The Main Menu',
  50. 'footer_links' => 'Footer Links',
  51. ));
  52. }
  53. add_action( 'init', 'bones_menus' );
  54. function bones_main_nav() { if ( function_exists( 'wp_nav_menu' ) )
  55. // display the wp3 menu if available
  56. wp_nav_menu( 'menu=main_nav&container_class=nav&fallback_cb=bones_main_nav_fallback' );
  57. else
  58. // else fallback if not supported
  59. mytheme_nav_fallback();
  60. }
  61. function bones_footer_links() { if ( function_exists( 'wp_nav_menu' ) )
  62. // display the wp3 menu if available
  63. wp_nav_menu( 'menu=footer_links&container_class=footer-links&fallback_cb=bones_footer_links_fallback' );
  64. else
  65. // else fallback if not supported
  66. bones_footer_links_fallback();
  67. }
  68. function bones_main_nav_fallback() { wp_page_menu( 'show_home=Start&menu_class=menu' ); }
  69. function bones_footer_links_fallback() { echo 'Bones'; }
  70. // Related Posts Function (call using bones_related_posts(); )
  71. function bones_related_posts() {
  72. echo '<ul id="bones-related-posts">';
  73. global $post;
  74. $tags = wp_get_post_tags($post->ID);
  75. if($tags) {
  76. foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
  77. $args = array(
  78. 'tag' => $tag_arr,
  79. 'numberposts' => 5,
  80. 'post__not_in' => array($post->ID)
  81. );
  82. $related_posts = get_posts($args);
  83. if($related_posts) {
  84. foreach ($related_posts as $post) : setup_postdata($post); ?>
  85. <li class="related_post"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  86. <?php endforeach; } else { ?>
  87. <li class="no_related_post">No Related Posts Yet!</li>
  88. <?php }
  89. }
  90. wp_reset_query();
  91. echo '</ul>';
  92. }
  93. ?>