0
由於某種原因,當我在wordpress博客上點擊「以前的帖子」時,頁面URL會發生變化,但前10個帖子會再次顯示。「以前的帖子」不能正常工作
你可以看到這裏的問題:http://onedirectionconnection.com/,然後網頁在兩次http://onedirectionconnection.com/page/2/#sthash.0SQiq9AP.dpbs(那是另一件事 - 我不知道爲什麼代碼下面的頁面的URL的末尾添加)...
不管怎麼說,這裏是我使用保存在一個名爲前page.php文件
<?php
/*
Template Name: Splash Page
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="section-container">
<h1 class="section-title">Latest News</h1>
</div>
<?php $my_query = new WP_Query('showposts=1'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h1 class="entry-title bottommargin big">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h1>
<div class="entry-content">
<?php the_content(); ?>
</div>
<div class="row">
<div class="col-md-12">
<footer class="row no-margin">
<div class="col-md-3 meta-entry">
Author: <br>
<?php the_author_link(); ?>
</div>
<div class="col-md-3 meta-entry">
Posted On:<br>
<?php the_time('F j, Y'); ?>
</div>
<div class="col-md-3 meta-entry">
Categorized:<br>
<?php echo get_the_category_list(', '); ?>
</div>
<div class="col-md-3 meta-entry-right">
Discussion:<br>
<a href="<?php comments_link(); ?>"><?php comments_number(); ?></a>
</div>
</footer>
</div>
</div>
<?php endwhile; ?>
<div class="section-container">
<h1 class="section-title">More News</h1>
</div>
<?php
$custom_query = new WP_Query(array(
'posts_per_page' => 10,
'offset' => 1,
'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1
));
?>
<?php while ($custom_query->have_posts()) : $custom_query->the_post(); ?>
<div class="row topmargin">
<div class="col-md-3 no-padding center">
<?php the_post_thumbnail('thumbnail', array('class' => 'img-thumbnail img-responsive')); ?>
</div>
<div class="col-md-9">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_excerpt(); ?>
<?php
wp_link_pages(array(
'before' => '<div class="page-links">' . __('Pages:', 'professional1d'),
'after' => '</div>',
));
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php
// If comments are open or we have at least one comment, load up the comment template
if (comments_open() || '0' != get_comments_number())
comments_template();
?>
</div>
</div>
<footer class="row no-margin">
<div class="col-md-3 meta-entry">
Author: <br>
<?php the_author_link(); ?>
</div>
<div class="col-md-3 meta-entry">
Posted On:<br>
<?php the_time('F j, Y'); ?>
</div>
<div class="col-md-3 meta-entry">
Categorized:<br>
<?php echo get_the_category_list(', '); ?>
</div>
<div class="col-md-3 meta-entry-right">
Discussion:<br>
<a href="<?php comments_link(); ?>"><?php comments_number(); ?></a>
</div>
</footer>
<?php endwhile; // end of the loop. ?>
<div class="center">
<?php posts_nav_link(); ?>
</div>
</main><!-- #main -->
</div><!-- #primary -->
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
一切文件我的頭版模板的代碼看起來很標準,所以我真的不知道是什麼問題。如果有人可以幫助我解決這個問題,將不勝感激!
我停用我的所有插件和問題依然存在安裝該插件..我還有其他的步驟嗎? – nellygrl
我想出了什麼插件在我的URL末尾添加了散列碼(它是sharethis)。我禁用了它,問題仍然存在。 – nellygrl
禁用插件後,您需要清除瀏覽器的緩存和Cookie ...甚至需要關閉瀏覽器..並重新打開Ctrl + F5 ... –