bones.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. // Adding WP 3.0 Functions
  30. //menus
  31. add_theme_support( 'menus' );
  32. // thumbnails
  33. add_theme_support('post-thumbnails');
  34. set_post_thumbnail_size(125, 125, true); /* more sizes are available using the functions.php file */
  35. // custom backgrounds
  36. add_custom_background();
  37. // header image
  38. define( 'HEADER_IMAGE', '%s/images/default-headbg.png' );
  39. define( 'HEADER_IMAGE_WIDTH', apply_filters( '', 960 ) ); // Width of Logo
  40. define( 'HEADER_IMAGE_HEIGHT', apply_filters( '', 150 ) ); // Height of Logo
  41. define( 'NO_HEADER_TEXT', true );
  42. add_custom_image_header( '', 'admin_header_style' );
  43. // Creating the Nav Menus
  44. function bones_menus() { register_nav_menus(
  45. array(
  46. 'main_nav' => 'The Main Menu',
  47. 'footer_links' => 'Footer Links',
  48. ));
  49. }
  50. add_action( 'init', 'bones_menus' );
  51. function bones_main_nav() { if ( function_exists( 'wp_nav_menu' ) )
  52. // display the wp3 menu if available
  53. wp_nav_menu( 'menu=main_nav&container_class=nav&fallback_cb=bones_main_nav_fallback' );
  54. else
  55. // else fallback if not supported
  56. mytheme_nav_fallback();
  57. }
  58. function bones_footer_links() { if ( function_exists( 'wp_nav_menu' ) )
  59. // display the wp3 menu if available
  60. wp_nav_menu( 'menu=footer_links&container_class=footer-links&fallback_cb=bones_footer_links_fallback' );
  61. else
  62. // else fallback if not supported
  63. bones_footer_links_fallback();
  64. }
  65. function bones_main_nav_fallback() { wp_page_menu( 'show_home=Start&menu_class=menu' ); }
  66. function bones_footer_links_fallback() { echo 'Bones'; }
  67. // Related Posts Function (call using bones_related_posts(); )
  68. function bones_related_posts() {
  69. echo '<ul id="bones-related-posts">';
  70. global $post;
  71. $tags = wp_get_post_tags($post->ID);
  72. if($tags) {
  73. foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
  74. $args = array(
  75. 'tag' => $tag_arr,
  76. 'numberposts' => 5,
  77. 'post__not_in' => array($post->ID)
  78. );
  79. $related_posts = get_posts($args);
  80. if($related_posts) {
  81. foreach ($related_posts as $post) : setup_postdata($post); ?>
  82. <li class="related_post"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  83. <?php endforeach; } else { ?>
  84. <li class="no_related_post">No Related Posts Yet!</li>
  85. <?php }
  86. }
  87. wp_reset_query();
  88. echo '</ul>';
  89. }
  90. ?>