Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

130 wiersze
5.5 KiB

  1. <?php
  2. /**
  3. * Template Name: Suche
  4. */
  5. get_header() ?>
  6. <?php
  7. $excluded_types = array('page', 'attachment', 'slide');
  8. $post_type_names = get_post_types(array(
  9. 'public' => true,
  10. ));
  11. $post_type_names = array_diff_key($post_type_names, array_flip($excluded_types));
  12. $query_types = get_query_var('post_type');
  13. if ( empty($query_types) ) {
  14. $query_types = array();
  15. } else if ( $query_types === 'any' ) {
  16. $query_types = array('post', 'kurs', 'download');
  17. }
  18. ?>
  19. <section id="content" class="articles wrapper container">
  20. <?php if ( have_posts() ) { ?>
  21. <header id="post-<?php the_ID() ?>" <?php post_class('section-header'); ?>>
  22. <h1 class="title"><?php printf(__( 'Search Results for:', 'sandbox' )); ?> <strong><?php the_search_query(); ?></strong></h1>
  23. <div class="content">
  24. <form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>">
  25. <label>
  26. <span class="screen-reader-text"><?php echo _x('Search for:', 'label', 'sandbox'); ?></span>
  27. <input type="search" class="search-field" placeholder="<?php echo esc_attr_x('Search &hellip;', 'placeholder', 'sandbox'); ?>" value="<?php echo get_search_query(); ?>" name="s" />
  28. </label>
  29. <button type="submit" class="search-submit"><?php echo esc_attr_x( 'Search', 'submit button', 'sandbox'); ?></button>
  30. <?php if ( is_search() && !empty($post_type_names) ) { ?>
  31. <div class="select-types">
  32. <?php foreach ( $post_type_names as $post_type_name ) { ?>
  33. <?php $post_type = get_post_type_object($post_type_name); ?>
  34. <div class="selection selection-<?php echo $post_type_name; ?>">
  35. <input type="checkbox" name="post_type[]" value="<?php echo $post_type_name; ?>" <?php if ( in_array($post_type_name, $query_types) ) { echo 'checked="checked"'; } ?> />
  36. <label><?php echo $post_type->label; ?></label>
  37. </div>
  38. <?php } ?>
  39. </div>
  40. <?php } ?>
  41. </form>
  42. <?php
  43. /*
  44. * @Sidebar Content
  45. */
  46. get_sidebar('meta'); ?>
  47. </div>
  48. </header><!-- .post -->
  49. <?php while ( have_posts() ) : the_post() ?>
  50. <?php
  51. $customPostsMeta = get_post_custom();
  52. $useCustomMoreText = ( !empty($customPostsMeta["_custom_more_text"]) && strlen($customPostsMeta["_custom_more_text"][0]) > 0 );
  53. $moreText = $useCustomMoreText ? $customPostsMeta["_custom_more_text"][0] : __('Weiterlesen', 'sandbox');
  54. // echo var_dump(!empty($customPostsMeta["_custom_more_text"]));
  55. ?>
  56. <article id="post-<?php the_ID() ?>" <?php post_class(); ?>>
  57. <div class="inner clearfix">
  58. <?php if ( has_post_thumbnail() ) { ?>
  59. <a href="<?php the_permalink() ?>" class="post-thumbnail"><?php the_post_thumbnail('thumbnail-full'); ?></a>
  60. <?php } ?>
  61. <h2 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  62. <div class="content">
  63. <?php the_excerpt(); ?>
  64. </div>
  65. </div>
  66. </article><!-- .post -->
  67. <?php endwhile; ?>
  68. <?php if ( is_paged() ) { ?>
  69. <?php if ( function_exists('wp_pagenavi') ) {
  70. wp_pagenavi(); // http://wordpress.org/plugins/wp-pagenavi/
  71. } else {
  72. ?>
  73. <nav id="nav-below" class="navigation">
  74. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&laquo;</span> Older results', 'sandbox' ) ) ?></div>
  75. <div class="nav-next"><?php previous_posts_link( __( 'Newer results <span class="meta-nav">&raquo;</span>', 'sandbox' ) ) ?></div>
  76. </nav>
  77. <?php } ?>
  78. <?php } ?>
  79. <?php } else { ?>
  80. <article id="content" class="post no-results not-found wrapper container">
  81. <div class="inner clearfix">
  82. <h1 class="title"><?php printf(__( 'Search Results for:', 'sandbox' )); ?> <strong><?php the_search_query(); ?></strong></h1>
  83. <div class="content">
  84. <form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>">
  85. <label>
  86. <span class="screen-reader-text"><?php echo _x('Search for:', 'label', 'sandbox'); ?></span>
  87. <input type="search" class="search-field" placeholder="<?php echo esc_attr_x('Search &hellip;', 'placeholder', 'sandbox'); ?>" value="<?php echo get_search_query(); ?>" name="s" />
  88. </label>
  89. <button type="submit" class="search-submit"><?php echo esc_attr_x( 'Search', 'submit button', 'sandbox'); ?></button>
  90. <?php if ( is_search() && !empty($post_type_names) ) { ?>
  91. <div class="select-types">
  92. <?php foreach ( $post_type_names as $post_type_name ) { ?>
  93. <?php $post_type = get_post_type_object($post_type_name); ?>
  94. <div class="selection selection-<?php echo $post_type_name; ?>">
  95. <input type="checkbox" name="post_type[]" value="<?php echo $post_type_name; ?>" <?php if ( in_array($post_type_name, $query_types) ) { echo 'checked="checked"'; } ?> />
  96. <label><?php echo $post_type->label; ?></label>
  97. </div>
  98. <?php } ?>
  99. </div>
  100. <?php } ?>
  101. </form>
  102. <h2><?php printf(__( 'Not Found', 'sandbox' )); ?></h2>
  103. <p><?php printf(__('Apologies, but we were unable to find what you were looking for. Perhaps searching will help.', 'sandbox')); ?></p>
  104. <p><a href="<?php echo esc_url( home_url() ); ?>"><?php printf(__('Go to the homepage', 'sandbox')); // 'zur Startseite gehen' ?></a></p>
  105. </div>
  106. </div>
  107. </article><!-- .post -->
  108. <?php } ?>
  109. </section>
  110. <?php get_footer() ?>