Guest User

Untitled

a guest
Mar 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <div class="center">
  2. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  3. <?php include 'product.php' ?>
  4. <?php endwhile ?>
  5. <nav class="pagination">
  6. <?php
  7. $big = 999999999; // need an unlikely integer
  8. echo paginate_links( array(
  9. 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
  10. 'format' => '?paged=%#%',
  11. 'current' => max( 1, get_query_var('paged') ),
  12. 'total' => $wp_query->max_num_pages,
  13. 'prev_text' => __(' « '),
  14. 'next_text' => __(' » '),
  15. ) );
  16. ?>
  17. </nav>
  18. <?php else : ?>
  19. <p>
  20. <?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?>
  21. </p>
  22. <?php endif; ?>
  23. </div>
  24.  
  25. function search_filter($query) {
  26. if ( !is_admin() && $query->is_main_query() ) {
  27. if ($query->is_search) {
  28. $query->set('post_type', array( 'drzewa_formowane', 'pre_bonsai' ) );
  29. }
  30. }
  31. }
  32.  
  33. add_action('pre_get_posts','search_filter');
Add Comment
Please, Sign In to add comment