0
我有一個搜索結果頁面的問題,分頁不起作用,當我想要轉到下一頁時,我被重定向到索引頁面,但網址是:www.mywebsite.com/ page/2 /?s = word ..搜索分頁wordpress
對於分頁工作的所有頁面,僅用於搜索不起作用。
這是search.php中的代碼
<?php
/**
* The template for displaying Search Results pages.
*/
get_header(); ?>
<?php
$search = isset($_GET['s']) ? $_GET['s']: null;
$user_filtre = '';
$user_display = '';
if($search){
$user_filtre .= 's=' . $_GET['s'] . '&';
$user_display .= 's=' . $_GET['s'] . '&';
}?>
<div id="main-search" class="content-dark hidden-sm hidden-xs">
<div class="container">
<form method="get" action="<?php bloginfo('url'); ?>" accept-charset="UTF-8">
<!--input name="s" id="s" type="hidden" -->
<div id="main-search-fields">
<p class="pull-left term">Search Term:</p>
<input name="s" value="<?php the_search_query(); ?>"autocomplete="off" type="search">
</div>
<div id="main-search-btn">
<input class="button-green-download-big" type="submit" value="Search">
</div>
</form>
</div>
</div>
<div class="browse-content">
<div class="container">
<section>
<div class="row">
<ul>
<?php if(have_posts()): ?>
<?php while (have_posts()) : the_post(); ?>
<?php include '_includes/items/item_2.php';?>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</div>
</section>
<?php novavideo_theme_pagination(); ?>
</div>
</div>
</div>
任何人都有一個IDEEA?
item_2.php。
<div class="browse-movie-wrap col-xs-10 col-sm-4 col-md-5 col-lg-4">
<a href="<?php the_permalink(); ?>" class="browse-movie-link">
<figure>
<?php if($values = get_post_custom_values("poster_url")) { ?>
<img class="img-responsive" src="<?php echo $values[0]; ?>" alt="<?php the_title();?> Watch Online" width="210" height="315">
<?php } ?>
<figcaption class="hidden-xs hidden-sm">
<span class="fa fa-star icon-color"></span>
<h4 class="rating"><?php $rating = get_post_custom_values("imdbRating"); echo $rating[0]; ?>/10</h4>
<h4>
<?php $categories = get_the_category();
if (! empty($categories[0])) {
echo esc_html($categories[0]->name);
}
?>
</h4>
<h4 class="quality-button"><span class="fa fa-play-circle"></span> <?php $terms_as_text = strip_tags(get_the_term_list($wp_query->post->ID, 'quality', '', ', ', '')); echo $terms_as_text;; ?></h4>
<span class="button-green-download-big margin-button">Open Movie</span>
</figcaption>
</figure>
</a>
<div class="browse-movie-bottom">
<a href="<?php the_permalink(); ?>" class="browse-movie-title"><?php $title = get_post_custom_values("Title"); echo $title[0]; ?></a>
<div class="browse-movie-year"><?php $terms = wp_get_post_terms($post->ID, 'release-year', array("fields" => "all")); if (! empty($terms) && ! is_wp_error($terms)){ foreach ($terms as $term_single) { $term_link = get_term_link($term_single); echo $term_single->name; } } ?></div>
</div>
</div>
不工作。當我想要轉到第2,3頁時,仍然將其重定向到主頁。 –
如果您要我爲您調試代碼,則必須清除所有這些包含文件。我無法分辨錯誤來自哪裏。 – staypuftman
我編輯了帖子,我關閉了search-template include,並且在那裏放了item_2.php。這個問題很奇怪,因爲在localhost和其他網站上完美地工作。 –