functions.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. // Get Bones Core Up & Running!
  10. require_once('library/bones.php'); // core functions (don't remove)
  11. require_once('library/plugins.php'); // plugins & extra functions (optional)
  12. require_once('library/custom-post-type.php'); // custom post type example
  13. /************* THUMBNAIL SIZE OPTIONS *************/
  14. // Thumbnail sizes
  15. add_image_size( 'bones-thumb-600', 600, 150, true );
  16. add_image_size( 'bones-thumb-300', 300, 100, true );
  17. /*
  18. to add more sizes, simply copy a line from above
  19. and change the dimensions & name. As long as you
  20. upload a "featured image" as large as the biggest
  21. set width or height, all the other sizes will be
  22. auto-cropped.
  23. To call a different size, simply change the text
  24. inside the thumbnail function.
  25. For example, to call the 300 x 300 sized image,
  26. we would use the function:
  27. <?php the_post_thumbnail( 'bones-thumb-300' ); ?>
  28. for the 600 x 100 image:
  29. <?php the_post_thumbnail( 'bones-thumb-600' ); ?>
  30. You can change the names and dimensions to whatever
  31. you like. Enjoy!
  32. */
  33. /************* ACTIVE SIDEBARS ********************/
  34. // Sidebars & Widgetizes Areas
  35. function bones_register_sidebars() {
  36. register_sidebar(array(
  37. 'id' => 'sidebar1',
  38. 'name' => 'Sidebar 1',
  39. 'description' => 'The first (primary) sidebar.',
  40. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  41. 'after_widget' => '</div>',
  42. 'before_title' => '<h4 class="widgettitle">',
  43. 'after_title' => '</h4>',
  44. ));
  45. /*
  46. to add more sidebars or widgetized areas, just copy
  47. and edit the above sidebar code. In order to call
  48. your new sidebar just use the following code:
  49. Just change the name to whatever your new
  50. sidebar's id is, for example:
  51. register_sidebar(array(
  52. 'id' => 'sidebar2',
  53. 'name' => 'Sidebar 2',
  54. 'description' => 'The second (secondary) sidebar.',
  55. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  56. 'after_widget' => '</div>',
  57. 'before_title' => '<h4 class="widgettitle">',
  58. 'after_title' => '</h4>',
  59. ));
  60. To call the sidebar in your template, you can just copy
  61. the sidebar.php file and rename it to your sidebar's name.
  62. So using the above example, it would be:
  63. sidebar-sidebar2.php
  64. */
  65. } // don't remove this bracket!
  66. /************* COMMENT LAYOUT *********************/
  67. // Comment Layout
  68. function bones_comments($comment, $args, $depth) {
  69. $GLOBALS['comment'] = $comment; ?>
  70. <li <?php comment_class(); ?>>
  71. <article id="comment-<?php comment_ID(); ?>" class="clearfix">
  72. <header class="comment-author vcard">
  73. <?php echo get_avatar($comment,$size='32',$default='<path_to_url>' ); ?>
  74. <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
  75. <time><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s'), get_comment_date(), get_comment_time()) ?></a></time>
  76. <?php edit_comment_link(__('(Edit)'),' ','') ?>
  77. </header>
  78. <?php if ($comment->comment_approved == '0') : ?>
  79. <div class="help">
  80. <p><?php _e('Your comment is awaiting moderation.') ?></p>
  81. </div>
  82. <?php endif; ?>
  83. <section class="comment_content clearfix">
  84. <?php comment_text() ?>
  85. </section>
  86. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  87. </article>
  88. <!-- </li> is added by wordpress automatically -->
  89. <?php
  90. } // don't remove this bracket!
  91. /************* SEARCH FORM LAYOUT *****************/
  92. // Search Form
  93. function bones_wpsearch($form) {
  94. $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  95. <label class="screen-reader-text" for="s">' . __('Search for:', 'bonestheme') . '</label>
  96. <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="Search the Site..." />
  97. <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
  98. </form>';
  99. return $form;
  100. } // don't remove this bracket!
  101. ?>