functions.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. /*
  3. Author: Eddie Machado
  4. URL: htp://themble.com/bones/
  5. This is where you can drop your custom functions or
  6. just edit things like thumbnail sizes, header images,
  7. sidebars, comments, ect.
  8. */
  9. /************* INCLUDE NEEDED FILES ***************/
  10. /*
  11. 1. library/bones.php
  12. - head cleanup (remove rsd, uri links, junk css, ect)
  13. - enqeueing scripts & styles
  14. - theme support functions
  15. - custom menu output & fallbacks
  16. - related post function
  17. - page-navi function
  18. - removing <p> from around images
  19. - customizing the post excerpt
  20. */
  21. require_once('library/bones.php'); // if you remove this, bones will break
  22. /*
  23. 2. library/custom-post-type.php
  24. - an example custom post type
  25. - example custom taxonomy (like categories)
  26. - example custom taxonomy (like tags)
  27. */
  28. require_once('library/custom-post-type.php'); // you can disable this if you like
  29. /*
  30. 3. library/admin.php
  31. - removing some default WordPress dashboard widgets
  32. - an example custom dashboard widget
  33. - adding custom login css
  34. - changing text in footer of admin
  35. */
  36. // require_once('library/admin.php'); // this comes turned off by default
  37. /*
  38. 4. library/plugins.php
  39. - expirimental functions or add-ons
  40. - custom facebook open graph integration
  41. - custom google+ integration
  42. - adding custom fields to user profiles
  43. */
  44. // require_once('library/plugins.php'); // this comes turned off by default
  45. /*
  46. 5. library/translation/translation.php
  47. - adding support for other languages
  48. */
  49. // require_once('library/translation/translation.php'); // this comes turned off by default
  50. /************* THUMBNAIL SIZE OPTIONS *************/
  51. // Thumbnail sizes
  52. add_image_size( 'bones-thumb-600', 600, 150, true );
  53. add_image_size( 'bones-thumb-300', 300, 100, true );
  54. /*
  55. to add more sizes, simply copy a line from above
  56. and change the dimensions & name. As long as you
  57. upload a "featured image" as large as the biggest
  58. set width or height, all the other sizes will be
  59. auto-cropped.
  60. To call a different size, simply change the text
  61. inside the thumbnail function.
  62. For example, to call the 300 x 300 sized image,
  63. we would use the function:
  64. <?php the_post_thumbnail( 'bones-thumb-300' ); ?>
  65. for the 600 x 100 image:
  66. <?php the_post_thumbnail( 'bones-thumb-600' ); ?>
  67. You can change the names and dimensions to whatever
  68. you like. Enjoy!
  69. */
  70. /************* ACTIVE SIDEBARS ********************/
  71. // Sidebars & Widgetizes Areas
  72. function bones_register_sidebars() {
  73. register_sidebar(array(
  74. 'id' => 'sidebar1',
  75. 'name' => 'Sidebar 1',
  76. 'description' => 'The first (primary) sidebar.',
  77. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  78. 'after_widget' => '</div>',
  79. 'before_title' => '<h4 class="widgettitle">',
  80. 'after_title' => '</h4>',
  81. ));
  82. /*
  83. to add more sidebars or widgetized areas, just copy
  84. and edit the above sidebar code. In order to call
  85. your new sidebar just use the following code:
  86. Just change the name to whatever your new
  87. sidebar's id is, for example:
  88. register_sidebar(array(
  89. 'id' => 'sidebar2',
  90. 'name' => 'Sidebar 2',
  91. 'description' => 'The second (secondary) sidebar.',
  92. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  93. 'after_widget' => '</div>',
  94. 'before_title' => '<h4 class="widgettitle">',
  95. 'after_title' => '</h4>',
  96. ));
  97. To call the sidebar in your template, you can just copy
  98. the sidebar.php file and rename it to your sidebar's name.
  99. So using the above example, it would be:
  100. sidebar-sidebar2.php
  101. */
  102. } // don't remove this bracket!
  103. /************* COMMENT LAYOUT *********************/
  104. // Comment Layout
  105. function bones_comments($comment, $args, $depth) {
  106. $GLOBALS['comment'] = $comment; ?>
  107. <li <?php comment_class(); ?>>
  108. <article id="comment-<?php comment_ID(); ?>" class="clearfix">
  109. <header class="comment-author vcard">
  110. <?php /*
  111. this is the new responsive optimized comment image. It used the new HTML5 data-attribute to display comment gravatars on larger screens only. What this means is that on larger posts, mobile sites don't have a ton of requests for comment images. This makes load time incredibly fast! If you'd like to change it back, just replace it with the regular wordpress gravatar call:
  112. echo get_avatar($comment,$size='32',$default='<path_to_url>' );
  113. */ ?>
  114. <!-- custom gravatar call -->
  115. <img data-gravatar="http://www.gravatar.com/avatar/<?php echo md5($bgauthemail); ?>&s=32" class="load-gravatar avatar avatar-48 photo" height="32" width="32" src="<?php echo get_template_directory_uri(); ?>/library/images/nothing.gif" />
  116. <!-- end custom gravatar call -->
  117. <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
  118. <time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time('F jS, Y'); ?> </a></time>
  119. <?php edit_comment_link(__('(Edit)'),' ','') ?>
  120. </header>
  121. <?php if ($comment->comment_approved == '0') : ?>
  122. <div class="help">
  123. <p><?php __('Your comment is awaiting moderation.') ?></p>
  124. </div>
  125. <?php endif; ?>
  126. <section class="comment_content clearfix">
  127. <?php comment_text() ?>
  128. </section>
  129. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  130. </article>
  131. <!-- </li> is added by wordpress automatically -->
  132. <?php
  133. } // don't remove this bracket!
  134. /************* SEARCH FORM LAYOUT *****************/
  135. // Search Form
  136. function bones_wpsearch($form) {
  137. $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  138. <label class="screen-reader-text" for="s">' . __('Search for:', 'bonestheme') . '</label>
  139. <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="Search the Site..." />
  140. <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
  141. </form>';
  142. return $form;
  143. } // don't remove this bracket!
  144. ?>