Advertisement
Guest User

porto theme search.php

a guest
Sep 14th, 2017
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. <?php get_header() ?>
  2.  
  3.  
  4.  
  5.  
  6.  
  7. <?php
  8.  
  9.  
  10.  
  11.  
  12.  
  13. $post_type = (isset($_GET['post_type']) && $_GET['post_type']) ? $_GET['post_type'] : null;
  14.  
  15.  
  16. if ( isset( $post_type ) && locate_template( 'archive-' . $post_type . '.php' ) ) {
  17.  
  18.  
  19. get_template_part( 'archive', $post_type );
  20.  
  21.  
  22. exit;
  23.  
  24.  
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. global $porto_settings, $porto_layout;
  32.  
  33.  
  34.  
  35.  
  36.  
  37. $post_layout = $porto_settings['post-layout'];
  38.  
  39.  
  40. $post_infinite = $porto_settings['blog-infinite'];
  41.  
  42.  
  43.  
  44.  
  45.  
  46. if ($post_infinite) {
  47.  
  48.  
  49. global $wp_rewrite, $wp_query;
  50.  
  51.  
  52.  
  53.  
  54.  
  55. $page_num = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
  56.  
  57.  
  58. $page_link = get_pagenum_link();
  59.  
  60.  
  61. $page_max_num = $wp_query->max_num_pages;
  62.  
  63.  
  64.  
  65.  
  66.  
  67. if ( !$wp_rewrite->using_permalinks() || is_admin() || strpos($page_link, '?') ) {
  68.  
  69.  
  70. if (strpos($page_link, '?') !== false)
  71.  
  72.  
  73. $page_path = apply_filters( 'get_pagenum_link', $page_link . '&amp;paged=');
  74.  
  75.  
  76. else
  77.  
  78.  
  79. $page_path = apply_filters( 'get_pagenum_link', $page_link . '?paged=');
  80.  
  81.  
  82. } else {
  83.  
  84.  
  85. $page_path = apply_filters( 'get_pagenum_link', $page_link . user_trailingslashit( $wp_rewrite->pagination_base . "/" ));
  86.  
  87.  
  88. }
  89.  
  90.  
  91. }
  92.  
  93.  
  94.  
  95.  
  96.  
  97. ?>
  98.  
  99.  
  100.  
  101.  
  102.  
  103. <div id="content" role="main" class="<?php if ($porto_layout === 'widewidth' || $porto_layout === 'wide-left-sidebar' || $porto_layout === 'wide-right-sidebar') { echo 'm-t-lg m-b-xl'; if (porto_get_wrapper_type() !=='boxed') echo ' m-r-md m-l-md'; } ?>">
  104.  
  105.  
  106.  
  107.  
  108.  
  109. <?php if ( have_posts() ) : ?>
  110.  
  111.  
  112.  
  113.  
  114.  
  115. <?php if ($post_layout == 'timeline') {
  116.  
  117.  
  118. global $prev_post_year, $prev_post_month, $first_timeline_loop, $post_count;
  119.  
  120.  
  121.  
  122.  
  123.  
  124. $prev_post_year = null;
  125.  
  126.  
  127. $prev_post_month = null;
  128.  
  129.  
  130. $first_timeline_loop = false;
  131.  
  132.  
  133. $post_count = 1;
  134.  
  135.  
  136. ?>
  137.  
  138.  
  139.  
  140.  
  141.  
  142. <div class="blog-posts posts-<?php echo $post_layout ?><?php if ($post_infinite) echo ' infinite-container' ?><?php if ($porto_settings['post-style'] == 'related') : ?> blog-posts-related<?php endif; ?>">
  143.  
  144.  
  145. <section class="timeline">
  146.  
  147.  
  148. <div class="timeline-body<?php if ($post_infinite) echo ' posts-infinite' ?>"<?php if ($post_infinite) : ?> data-pagenum="<?php echo esc_attr($page_num) ?>" data-pagemaxnum="<?php echo esc_attr($page_max_num) ?>" data-path="<?php echo esc_url($page_path) ?>"<?php endif; ?>>
  149.  
  150.  
  151.  
  152.  
  153.  
  154. <?php } else if ($post_layout == 'grid') { ?>
  155.  
  156.  
  157.  
  158.  
  159.  
  160. <div class="blog-posts posts-<?php echo $post_layout ?><?php if ($post_infinite) echo ' infinite-container' ?><?php if ($porto_settings['post-style'] == 'related') : ?> blog-posts-related<?php endif; ?>">
  161.  
  162.  
  163. <div class="grid row<?php if ($post_infinite) echo ' posts-infinite' ?>"<?php if ($post_infinite) : ?> data-pagenum="<?php echo esc_attr($page_num) ?>" data-pagemaxnum="<?php echo esc_attr($page_max_num) ?>" data-path="<?php echo esc_url($page_path) ?>"<?php endif; ?>>
  164.  
  165.  
  166.  
  167.  
  168.  
  169. <?php } else { ?>
  170.  
  171.  
  172.  
  173.  
  174.  
  175. <div class="blog-posts posts-<?php echo $post_layout ?><?php if ($post_infinite) echo ' infinite-container posts-infinite' ?>"<?php if ($post_infinite) : ?> data-pagenum="<?php echo esc_attr($page_num) ?>" data-pagemaxnum="<?php echo esc_attr($page_max_num) ?>" data-path="<?php echo esc_url($page_path) ?>"<?php endif; ?>>
  176.  
  177.  
  178.  
  179.  
  180.  
  181. <?php } ?>
  182.  
  183.  
  184.  
  185.  
  186.  
  187. <?php
  188.  
  189.  
  190. while (have_posts()) {
  191.  
  192.  
  193. the_post();
  194.  
  195.  
  196.  
  197.  
  198.  
  199. get_template_part('content', 'blog-'.$post_layout);
  200.  
  201.  
  202. }
  203.  
  204.  
  205. ?>
  206.  
  207.  
  208.  
  209.  
  210.  
  211. <?php if ($post_layout == 'timeline') { ?>
  212.  
  213.  
  214.  
  215.  
  216.  
  217. </div>
  218.  
  219.  
  220. </section>
  221.  
  222.  
  223.  
  224.  
  225.  
  226. <?php } else if ($post_layout == 'grid') { ?>
  227.  
  228.  
  229.  
  230.  
  231.  
  232. </div>
  233.  
  234.  
  235.  
  236.  
  237.  
  238. <?php } else { ?>
  239.  
  240.  
  241.  
  242.  
  243.  
  244. <?php } ?>
  245.  
  246.  
  247.  
  248.  
  249.  
  250. <?php porto_pagination(); ?>
  251.  
  252.  
  253. </div>
  254.  
  255.  
  256.  
  257.  
  258.  
  259. <?php wp_reset_postdata(); ?>
  260.  
  261.  
  262.  
  263.  
  264.  
  265. <?php else : ?>
  266.  
  267.  
  268.  
  269.  
  270.  
  271. <h2 class="entry-title m-b"><?php _e( 'Nothing Found', 'porto' ); ?></h2>
  272.  
  273.  
  274.  
  275.  
  276.  
  277. <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
  278.  
  279.  
  280.  
  281.  
  282.  
  283. <p class="alert alert-info"><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'porto' ), admin_url( 'post-new.php' ) ); ?></p>
  284.  
  285.  
  286.  
  287.  
  288.  
  289. <?php elseif ( is_search() ) : ?>
  290.  
  291.  
  292.  
  293.  
  294.  
  295. <p class="alert alert-info"><?php _e( 'Sorry, but nothing matched your search terms. Please try again with different keywords.', 'porto' ); ?></p>
  296.  
  297.  
  298. <?php get_search_form(); ?>
  299.  
  300.  
  301.  
  302.  
  303.  
  304. <?php else : ?>
  305.  
  306.  
  307.  
  308.  
  309.  
  310. <p class="alert alert-info"><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'porto' ); ?></p>
  311.  
  312.  
  313. <?php get_search_form(); ?>
  314.  
  315.  
  316.  
  317.  
  318.  
  319. <?php endif; ?>
  320.  
  321.  
  322.  
  323.  
  324.  
  325. <?php endif; ?>
  326.  
  327.  
  328. </div>
  329.  
  330.  
  331.  
  332.  
  333.  
  334. <?php get_footer() ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement