Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Get required Globals
- global $wp_query, $query_string;
- $s = isset($_GET['s']) ? $_GET['s'] : '';
- $p = isset($_GET['page']) ? $_GET['page'] : 1;
- # Search Results Instance
- $results = new WP_Query(array(
- 's' => $s,
- 'paged' => $p,
- 'posts_per_page' => $wp_query->query_vars['posts_per_page'],
- 'post_type' => 'post'
- ));
- $found_posts = $results->found_posts;
- $posts_per_page = $results->query_vars['posts_per_page'];
- $paged = $results->query_vars['paged'];
- $max_pages = 0;
- if($found_posts > $posts_per_page)
- {
- $max_pages = ceil($found_posts / $posts_per_page);
- }
- get_header();
- ?>
- <?php if($results->have_posts()): ?>
- <div class="content">
- <?php while($results->have_posts()): $results->the_post(); ?>
- <div class="post-blog" id="post-<?php get_the_ID(); ?>" <?php post_class(); ?>>
- <?php the_post_thumbnail('blog'); ?>
- <?php the_excerpt(); ?>
- </div><!-- /#post-<?php get_the_ID(); ?> -->
- <?php endwhile; ?>
- <?php next_posts_link(); ?>
- </div>
- <?php get_sidebar(); ?>
- <?php else: ?>
- <div class="no_search_results">
- <?php echo sprintf(__('Sorry but your search "<strong>%s</strong>" did not match any documents. Please try again with some different keywords.', 'theme', TD), $s); ?>
- </div>
- <?php endif; ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement