grysom

Untitled

Apr 25th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. <?php
  2.  
  3. function exclude_category($query) {
  4. if ( $query->is_home ) {
  5. $query->set('cat', '-4, -10');
  6. }
  7. return $query;
  8. }
  9.  
  10. add_filter('pre_get_posts', 'exclude_category');
  11.  
  12. function SearchFilter($query) {
  13. if ($query->is_search) {
  14. $query->set('post_type', 'post');
  15. }
  16. return $query;
  17. }
  18.  
  19. add_filter('pre_get_posts','SearchFilter');
  20.  
  21. // WP 3.0 custom background compatibility
  22. add_custom_background();
  23.  
  24. /// WP 3.0 menus compatibility
  25. register_nav_menus( array(
  26. 'primary' => __( 'Primary Navigation' ),
  27. ) );
  28.  
  29. function new_nav_menu_items($items) {
  30. $homelink = '<li class="home"><a href="' . home_url( '/' ) . '">' . __('Titulka') . '</a></li>';
  31. $items = $homelink . $items;
  32. return $items;
  33. }
  34.  
  35. add_filter('wp_nav_menu_items','new_nav_menu_items');
  36. add_filter('wp_list_pages','new_nav_menu_items');
  37.  
  38.  
  39.  
  40. if ( function_exists('register_sidebar') )
  41. {
  42. register_sidebar(array('name' => 'Sidebar Top','before_widget' => '<div class="sidebar-background">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  43. register_sidebar(array('name' => 'Sidebar Left','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
  44. register_sidebar(array('name' => 'Sidebar Right','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
  45. register_sidebar(array('name' => 'Sidebar Bottom','before_widget' => '<div class="sidebar-background">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  46. register_sidebar(array('name' => 'Footer Left','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
  47. register_sidebar(array('name' => 'Footer Center','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
  48. register_sidebar(array('name' => 'Footer Right','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
  49. }
  50.  
  51.  
  52. remove_filter('get_the_excerpt', 'wp_trim_excerpt');
  53. add_filter('get_the_excerpt', 'custom_trim_excerpt');
  54.  
  55. remove_filter('get_the_excerpt', 'wp_trim_excerpt');
  56. add_filter('get_the_excerpt', 'custom_trim_excerpt');
  57.  
  58. function custom_trim_excerpt($text) { // Fakes an excerpt if needed
  59. global $post;
  60. if ( '' == $text ) {
  61. $text = get_the_content('');
  62.  
  63. $text = strip_shortcodes( $text );
  64.  
  65. $text = apply_filters('the_content', $text);
  66. $text = str_replace(']]>', ']]&gt;', $text);
  67. $text = strip_tags($text);
  68. $excerpt_length = apply_filters('excerpt_length', 90);
  69. $words = explode(' ', $text, $excerpt_length + 1);
  70. if (count($words) > $excerpt_length) {
  71. array_pop($words);
  72. array_push($words, '...');
  73. $text = implode(' ', $words);
  74. }
  75. }
  76. return $text;
  77. }
  78.  
  79. // WP 3.0 post thumbnails compatibility
  80. if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
  81. add_theme_support( 'post-thumbnails' );
  82.  
  83. add_image_size( 'headline', 300, 275, true ); // Permalink thumbnail size
  84. add_image_size( 'novinky', 100, 65, true );
  85. add_image_size( 'front-list', 150, 150, true );
  86. }
  87.  
  88. if ( ! function_exists( 'arthemia_comment' ) ) :
  89. /**
  90. * Template for comments and pingbacks.
  91. *
  92. * To override this walker in a child theme without modifying the comments template
  93. * simply create your own twentyten_comment(), and that function will be used instead.
  94. *
  95. * Used as a callback by wp_list_comments() for displaying the comments.
  96. *
  97. * @since Twenty Ten 1.0
  98. */
  99. function arthemia_comment( $comment, $args, $depth ) {
  100. $GLOBALS['comment'] = $comment;
  101.  
  102. ?>
  103. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  104. <div id="comment-<?php comment_ID(); ?>">
  105. <div class="clearfloat">
  106.  
  107. <?php echo get_avatar( $comment, $size = '55' ); ?>
  108.  
  109.  
  110. <div class="commenttext">
  111. <cite><strong><?php comment_author_link() ?> <?php if($isByAuthor ) { echo '(author)';} ?> </strong> říká: </cite>
  112.  
  113. <?php if ($comment->comment_approved == '0') : ?>
  114. <em>Tvůj názor čeká na cenzuru.</em>
  115. <?php endif; ?>
  116. <?php comment_text() ?>
  117. </div>
  118. </div>
  119.  
  120. <div class="commentmetadata">
  121. <div class="reply">
  122. <?php comment_reply_link( array_merge( $args, array('reply_text'=>__('Odpověz na koment &raquo;','arthemia'), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  123. </div><!-- .reply -->
  124. # <?php comment_date('j F Y') ?> v <?php comment_time() ?>
  125. </div>
  126.  
  127. </div><!-- #comment-## -->
  128.  
  129.  
  130.  
  131. <?php
  132. }
  133. endif;
  134.  
  135. ?>
Advertisement
Add Comment
Please, Sign In to add comment