functions.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. - custom google+ integration
  21. - adding custom fields to user profiles
  22. */
  23. require_once('library/bones.php'); // if you remove this, bones will break
  24. /*
  25. 2. library/custom-post-type.php
  26. - an example custom post type
  27. - example custom taxonomy (like categories)
  28. - example custom taxonomy (like tags)
  29. */
  30. require_once('library/custom-post-type.php'); // you can disable this if you like
  31. /*
  32. 3. library/admin.php
  33. - removing some default WordPress dashboard widgets
  34. - an example custom dashboard widget
  35. - adding custom login css
  36. - changing text in footer of admin
  37. */
  38. // require_once('library/admin.php'); // this comes turned off by default
  39. /*
  40. 4. library/translation/translation.php
  41. - adding support for other languages
  42. */
  43. // require_once('library/translation/translation.php'); // this comes turned off by default
  44. /************* THUMBNAIL SIZE OPTIONS *************/
  45. // Thumbnail sizes
  46. add_image_size( 'bones-thumb-600', 600, 150, true );
  47. add_image_size( 'bones-thumb-300', 300, 100, true );
  48. /*
  49. to add more sizes, simply copy a line from above
  50. and change the dimensions & name. As long as you
  51. upload a "featured image" as large as the biggest
  52. set width or height, all the other sizes will be
  53. auto-cropped.
  54. To call a different size, simply change the text
  55. inside the thumbnail function.
  56. For example, to call the 300 x 300 sized image,
  57. we would use the function:
  58. <?php the_post_thumbnail( 'bones-thumb-300' ); ?>
  59. for the 600 x 100 image:
  60. <?php the_post_thumbnail( 'bones-thumb-600' ); ?>
  61. You can change the names and dimensions to whatever
  62. you like. Enjoy!
  63. */
  64. /************* ACTIVE SIDEBARS ********************/
  65. // Sidebars & Widgetizes Areas
  66. function bones_register_sidebars() {
  67. register_sidebar(array(
  68. 'id' => 'sidebar1',
  69. 'name' => 'Sidebar 1',
  70. 'description' => 'The first (primary) sidebar.',
  71. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  72. 'after_widget' => '</div>',
  73. 'before_title' => '<h4 class="widgettitle">',
  74. 'after_title' => '</h4>',
  75. ));
  76. /*
  77. to add more sidebars or widgetized areas, just copy
  78. and edit the above sidebar code. In order to call
  79. your new sidebar just use the following code:
  80. Just change the name to whatever your new
  81. sidebar's id is, for example:
  82. register_sidebar(array(
  83. 'id' => 'sidebar2',
  84. 'name' => 'Sidebar 2',
  85. 'description' => 'The second (secondary) sidebar.',
  86. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  87. 'after_widget' => '</div>',
  88. 'before_title' => '<h4 class="widgettitle">',
  89. 'after_title' => '</h4>',
  90. ));
  91. To call the sidebar in your template, you can just copy
  92. the sidebar.php file and rename it to your sidebar's name.
  93. So using the above example, it would be:
  94. sidebar-sidebar2.php
  95. */
  96. } // don't remove this bracket!
  97. /************* COMMENT LAYOUT *********************/
  98. // Comment Layout
  99. function bones_comments($comment, $args, $depth) {
  100. $GLOBALS['comment'] = $comment; ?>
  101. <li <?php comment_class(); ?>>
  102. <article id="comment-<?php comment_ID(); ?>" class="clearfix">
  103. <header class="comment-author vcard">
  104. <?php /*
  105. 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:
  106. echo get_avatar($comment,$size='32',$default='<path_to_url>' );
  107. */ ?>
  108. <!-- custom gravatar call -->
  109. <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" />
  110. <!-- end custom gravatar call -->
  111. <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
  112. <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>
  113. <?php edit_comment_link(__('(Edit)', 'bonestheme'),' ','') ?>
  114. </header>
  115. <?php if ($comment->comment_approved == '0') : ?>
  116. <div class="alert info">
  117. <p><?php _e('Your comment is awaiting moderation.', 'bonestheme') ?></p>
  118. </div>
  119. <?php endif; ?>
  120. <section class="comment_content clearfix">
  121. <?php comment_text() ?>
  122. </section>
  123. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  124. </article>
  125. <!-- </li> is added by wordpress automatically -->
  126. <?php
  127. } // don't remove this bracket!
  128. /************* SEARCH FORM LAYOUT *****************/
  129. // Search Form
  130. function bones_wpsearch($form) {
  131. $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  132. <label class="screen-reader-text" for="s">' . __('Search for:', 'bonestheme') . '</label>
  133. <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="'.esc_attr__('Search the Site...','bonestheme').'" />
  134. <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
  135. </form>';
  136. return $form;
  137. } // don't remove this bracket!
  138. ?>