bones.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. add_theme_support('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. // adding post format support
  44. add_theme_support( 'post-formats',
  45. array(
  46. 'aside', /* Typically styled without a title. Similar to a Facebook note update */
  47. 'gallery', /* A gallery of images. Post will likely contain a gallery shortcode and will have image attachments */
  48. 'link', /* A link to another site. Themes may wish to use the first <a href=ÓÓ> tag in the post content as the external link for that post. An alternative approach could be if the post consists only of a URL, then that will be the URL and the title (post_title) will be the name attached to the anchor for it */
  49. 'image', /* A single image. The first <img /> tag in the post could be considered the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image */
  50. 'quote', /* A quotation. Probably will contain a blockquote holding the quote content. Alternatively, the quote may be just the content, with the source/author being the title */
  51. 'status', /*A short status update, similar to a Twitter status update */
  52. 'video', /* A single video. The first <video /> tag or object/embed in the post content could be considered the video. Alternatively, if the post consists only of a URL, that will be the video URL. May also contain the video as an attachment to the post, if video support is enabled on the blog (like via a plugin) */
  53. 'audio', /* An audio file. Could be used for Podcasting */
  54. 'chat' /* A chat transcript */
  55. )
  56. );
  57. // Creating the Nav Menus
  58. function bones_menus() {
  59. if (function_exists( 'register_nav_menus' )) {
  60. register_nav_menus(
  61. array(
  62. 'main_nav' => 'The Main Menu',
  63. 'footer_links' => 'Footer Links'
  64. )
  65. );
  66. }
  67. }
  68. add_action( 'init', 'bones_menus' );
  69. function bones_main_nav() {
  70. // display the wp3 menu if available
  71. wp_nav_menu(
  72. array(
  73. 'menu' => 'main_nav', /* menu name */
  74. 'theme_location' => 'main_nav', /* where in the theme it's assigned */
  75. 'container_class' => 'menu', /* container class */
  76. 'fallback_cb' => 'bones_main_nav_fallback' /* menu fallback */
  77. )
  78. );
  79. }
  80. function bones_footer_links() {
  81. // display the wp3 menu if available
  82. wp_nav_menu(
  83. array(
  84. 'menu' => 'footer_links', /* menu name */
  85. 'theme_location' => 'footer_links', /* where in the theme it's assigned */
  86. 'container_class' => 'footer-links', /* container class */
  87. 'fallback_cb' => 'bones_footer_links_fallback' /* menu fallback */
  88. )
  89. );
  90. }
  91. function bones_main_nav_fallback() { wp_page_menu( 'show_home=Home&menu_class=menu' ); }
  92. function bones_footer_links_fallback() { echo '<ul class="footer-links"><li>Bones<li></ul>'; }
  93. // Related Posts Function (call using bones_related_posts(); )
  94. function bones_related_posts() {
  95. echo '<ul id="bones-related-posts">';
  96. global $post;
  97. $tags = wp_get_post_tags($post->ID);
  98. if($tags) {
  99. foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
  100. $args = array(
  101. 'tag' => $tag_arr,
  102. 'numberposts' => 5,
  103. 'post__not_in' => array($post->ID)
  104. );
  105. $related_posts = get_posts($args);
  106. if($related_posts) {
  107. foreach ($related_posts as $post) : setup_postdata($post); ?>
  108. <li class="related_post"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  109. <?php endforeach; } else { ?>
  110. <li class="no_related_post">No Related Posts Yet!</li>
  111. <?php }
  112. }
  113. wp_reset_query();
  114. echo '</ul>';
  115. }
  116. ?>