Advertisement
Sosoof

Untitled

Feb 2nd, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. <?php
  2.  
  3. //////////////////////////////////////////
  4. // Set the content width based on the theme's design and stylesheet.
  5. if ( ! isset( $content_width ) )
  6. $content_width = 610;
  7.  
  8. //////////////////////////////////////////
  9. // Set Widgets
  10. function birdsite_widgets_init() {
  11.  
  12. if ( function_exists('register_sidebar') ){
  13. register_sidebar( array (
  14. 'name' => 'widget-area',
  15. 'id' => 'widget-area',
  16. 'description' => 'Widget Area for footer',
  17. 'before_widget' => '<div class="widget">',
  18. 'after_widget' => '</div>',
  19. 'before_title' => '<h3>',
  20. 'after_title' => '</h3>',
  21. ) );
  22. }
  23. }
  24.  
  25. //////////////////////////////////////////
  26. // SinglePage Comment callback
  27. function birdsite_custom_comments($comment, $args) {
  28. $GLOBALS['comment'] = $comment;
  29.  
  30. ?>
  31.  
  32. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  33.  
  34. <?php if('pingback' == $comment->comment_type || 'trackback' == $comment->comment_type):
  35. $url = get_comment_author_url();
  36. $author = get_comment_author();
  37. ?>
  38. <div class="posted"><?php _e( 'Pingback', 'birdsite' ); ?></div>
  39.  
  40. <div class="web"><a href="<?php echo $url; ?>" target="_blank"><?php echo $author ?></a><?php edit_comment_link( __('(Edit)', 'birdsite'), ' ' ); ?></div>
  41.  
  42. <?php else: ?>
  43. <div class="posted">
  44. <div class="author"><?php comment_author(); ?></div>
  45. <div class="time"><?php echo get_comment_time(get_option('date_format') .' H:i'); ?></div>
  46. <?php echo get_avatar( $comment, 40 ); ?>
  47. </div>
  48.  
  49. <?php comment_text(); ?>
  50. <?php $author_url = get_comment_author_url(); ?>
  51. <?php if(!empty($author_url)): ?>
  52. <div class="web"><a href="<?php echo $author_url; ?>" target="_blank"><?php echo $author_url; ?></a></div>
  53. <?php endif; ?>
  54. <?php endif; ?>
  55. <?php
  56. // no "</li>" conform WORDPRESS
  57. }
  58.  
  59. //////////////////////////////////////////////////////
  60. // Pagenation
  61. function birdsite_the_pagenation() {
  62.  
  63. global $wp_rewrite;
  64. global $wp_query;
  65. global $paged;
  66.  
  67. $paginate_base = get_pagenum_link(1);
  68. if (strpos($paginate_base, '?') || ! $wp_rewrite->using_permalinks()) {
  69. $paginate_format = '';
  70. $paginate_base = add_query_arg('paged', '%#%');
  71. } else {
  72. $paginate_format = (substr($paginate_base, -1 ,1) == '/' ? '' : '/') .
  73. user_trailingslashit('page/%#%/', 'paged');;
  74. $paginate_base .= '%_%';
  75. }
  76. echo paginate_links( array(
  77. 'base' => $paginate_base,
  78. 'format' => $paginate_format,
  79. 'total' => $wp_query->max_num_pages,
  80. 'mid_size' => 3,
  81. 'current' => ($paged ? $paged : 1),
  82. ));
  83. }
  84.  
  85. //////////////////////////////////////////////////////
  86. // Search form
  87. function birdsite_search_form( $form ) {
  88.  
  89. $search_string = '';
  90. if(is_search()){
  91. $search_string = get_search_query();
  92. }
  93.  
  94. $form = '<form method="get" id="searchform" action="' .home_url( '/' ) .'">
  95. <div id="qsearch">
  96. <input type="text" name="s" id="s" value="' .$search_string .'" />
  97. <input class="btn" alt="' .__('Search', 'birdsite') .'" type="image" src="' .get_bloginfo('template_url') .'/images/search.gif" title="' .__('Search', 'birdsite') .'" id="searchsubmit" value="' . __('Search', 'birdsite') .'" />
  98. </div>
  99. </form>';
  100.  
  101. return $form;
  102. }
  103.  
  104. //////////////////////////////////////////////////////
  105. // Show thumbnail
  106. function birdsite_the_thumbnail() {
  107.  
  108. global $post;
  109.  
  110. $id = (int) $post->ID;
  111. if ( $id == 0 ) {
  112. return false;
  113. }
  114.  
  115. $html = get_the_post_thumbnail($id, array(150,150));
  116. if(!empty($html)){
  117. echo '<a href="' .get_permalink($id) .'">' .$html .'</a>';
  118. }
  119. }
  120.  
  121. //////////////////////////////////////////////////////
  122. // Header Style
  123. function birdsite_header_style() {
  124. ?>
  125. <style type="text/css">
  126. #header {
  127. width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
  128. height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
  129. background: #FFF url(<?php header_image(); ?>) no-repeat center;
  130. }
  131.  
  132. <?php
  133. if ( 'blank' == get_header_textcolor() ) { ?>
  134. #header * {
  135. display: none;
  136. }
  137. <?php } else { ?>
  138. #header *,
  139. #header ul li a,
  140. #header ul li a:hover,
  141. #header ul li.current_page_item > a {
  142. color: #<?php header_textcolor();?>;
  143. }
  144. #header ul li {
  145. border-right-color: #<?php header_textcolor();?>;
  146. }
  147. a, a:visited {
  148. color: #<?php header_textcolor();?>;
  149. }
  150.  
  151. <?php } ?>
  152. </style>
  153. <?php
  154. }
  155.  
  156. //////////////////////////////////////////////////////
  157. // Admin Header Style
  158. function birdsite_admin_header_style() {
  159. ?>
  160. <style type="text/css">
  161. #headimg {
  162. width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
  163. height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
  164. background: url(<?php header_image(); ?>) no-repeat center;
  165. }
  166.  
  167. #headimg *
  168. {
  169. text-decoration: none;
  170. color: #<?php header_textcolor();?>;
  171. }
  172. </style>
  173. <?php
  174. }
  175.  
  176. //////////////////////////////////////////////////////
  177. // Setup Theme
  178. function birdsite_setup() {
  179.  
  180. // Set languages
  181. load_theme_textdomain( 'birdsite', TEMPLATEPATH . '/languages' );
  182.  
  183. // This theme styles the visual editor with editor-style.css to match the theme style.
  184. add_editor_style();
  185.  
  186. // Set feed
  187. add_theme_support( 'automatic-feed-links' );
  188.  
  189. // This theme uses post thumbnails
  190. add_theme_support( 'post-thumbnails' );
  191.  
  192. // This theme uses wp_nav_menu() in one location.
  193. register_nav_menus( array(
  194. 'primary' => __( 'Primary Navigation', 'birdsite' ),
  195. ) );
  196.  
  197. // This theme allows users to set a custom background
  198. add_custom_background();
  199.  
  200. // Add a way for the custom header
  201. define( 'HEADER_TEXTCOLOR', '06C' );
  202. define( 'HEADER_IMAGE', '%s/images/headers/buna.jpg' );
  203. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 610 ) );
  204. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 200 ) );
  205. add_custom_image_header( 'birdsite_header_style', 'birdsite_admin_header_style' );
  206.  
  207. register_default_headers( array(
  208. 'buna' => array(
  209. 'url' => '%s/images/headers/buna.jpg',
  210. 'thumbnail_url' => '%s/images/headers/buna-thumbnail.jpg',
  211. 'description' => 'Buna'
  212. ),
  213. 'keyaki' => array(
  214. 'url' => '%s/images/headers/keyaki.jpg',
  215. 'thumbnail_url' => '%s/images/headers/keyaki-thumbnail.jpg',
  216. 'description' => 'Keyaki'
  217. ),
  218. 'hinoki' => array(
  219. 'url' => '%s/images/headers/hinoki.jpg',
  220. 'thumbnail_url' => '%s/images/headers/hinoki-thumbnail.jpg',
  221. 'description' => 'Hinoki'
  222. ),
  223. 'sugi' => array(
  224. 'url' => '%s/images/headers/sugi.jpg',
  225. 'thumbnail_url' => '%s/images/headers/sugi-thumbnail.jpg',
  226. 'description' => 'Sugi'
  227. ),
  228. 'kusu' => array(
  229. 'url' => '%s/images/headers/kusu.jpg',
  230. 'thumbnail_url' => '%s/images/headers/kusu-thumbnail.jpg',
  231. 'description' => 'Kusu'
  232. ),
  233. 'white' => array(
  234. 'url' => '%s/images/headers/white.jpg',
  235. 'thumbnail_url' => '%s/images/headers/white-thumbnail.jpg',
  236. 'description' => 'White'
  237. )
  238. ) );
  239. }
  240.  
  241. //////////////////////////////////////////////////////
  242. // Action Hook
  243. add_action( 'widgets_init', 'birdsite_widgets_init' );
  244. add_action( 'after_setup_theme', 'birdsite_setup' );
  245. add_filter( 'get_search_form', 'birdsite_search_form' );
  246. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement