functions.php 4.3 KB

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