0

wordpressのブログで、なぜか「前の投稿」をクリックすると、ページのURLが変わるのに、最初の10件の投稿が再び表示されてしまいます。

ここで問題を確認できます: http://onedirectionconnection.com/そして 2 ページ目 http://onedirectionconnection.com/page/2/#sthash.0SQiq9AP.dpbs (それは別のことです - なぜそのコードなのかわかりません)下記ページのURLの末尾に追記中)…

とにかく、これが私のフロントページテンプレートに使用しているコードで、front-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(); ?>

すべてがかなり標準的なように見えるので、何が問題なのか本当にわかりません。誰かがこの問題で私を助けることができれば、それは大歓迎です!

4

1 に答える 1

1

ブログの 2 ~ 3 つの投稿/ページを比較した後。URL の末尾に # タグを追加すると思います。これは、ページ全体をロードした後にのみ発生します。つまり、プラグインの 1 つによって追加されます。プラグインは、「ローカルブラウザーキャッシュの代わりにサーバーから新しいコンテンツをロードする」ためのものである可能性があります

最初に、この種の機能のためにインストールしたプラグインを無効にします

于 2013-10-28T05:05:11.897 に答える