サポート » 使い方全般 » ページャー設置について

  • 解決済 tak7910

    (@tak7910)


    いつもお世話になっております。

    先週末くらいから、ページャーの設置を行おうとしているのですが、404の洗礼を受けてしまいました。
    query_postがだめだとか、いろいろサイト上の情報をかき集めてだめだったので、
    最終手段として、twenty-fourteenのデフォルトの書き出しをベースに作成し直しました。
    その結果家では上手く行ってた!?(眠かったのでそう思いたかっただけなのかもしれないですが…)

    会社に来て、いざ実装すると2ページ目が404になってしまいました。

    プラグインも全て外して、query_postも外したのに、原因が分からずお手上げ状態です。
    どなたか何かしらのヒントだけでもいいので与えていただければと思います。

    <?php if ( have_posts() ) : ?>
    
    														<?php
    					// Start the Loop.
    					while ( have_posts() ) : the_post();
    
    					/*
    					 * Include the post format-specific template for the content. If you want to
    					 * use this in a child theme, then include a file called called content-___.php
    					 * (where ___ is the post format) and that will be used instead.
    					 */
    					get_template_part( 'content-blog', get_post_format() );
    
    					endwhile;
    					// Previous/next page navigation.
    					twentyfourteen_paging_nav();
    
    				else :
    					// If no content, include the "No posts found" template.
    					get_template_part( 'content', 'none' );
    
    				endif;
    			?>

    contemt-blogの中身

    <li>
    									<section>
    										<div class="blog-list">
    											<dl class="heightLine">
    
    <dl class="heightLine">		
    
    <dt><?php
    $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image");
    if (empty($files)){
      print "none";
    }else{
      $keys = array_keys($files);
            $lastkeys = array_pop($keys);
            $num=$lastkeys;
            $thumb=wp_get_attachment_image_src($num,'medium');
        print '<img src="' . $thumb[0] . '" width="278" alt="' . $post->post_title . 'の画像">' . "";
    }
    ?></dt>-->
    				<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    <dd>
    													<p class="blog-list-date"><?php the_time('Y.m.d');?></p>
    <div class="blog-list-title"><?php
    			endif;
    
    			if ( is_single() ) :
    				the_title( '<h1 class="entry-title">', '</h1>' );
    			else :
    				the_title();
    			endif;
    		?></div>
    													<div class="blog-list-cont"><?php echo mb_substr(get_the_excerpt(), 0, 40); ?>…</div>
    													<p class="blog-list-next"><a href="<?php the_permalink(); ?>" rel="bookmark">記事の続きはこちら</a></p>
    												</dd>
    											</dl>
    										</div>
    									</section>
    								</li>
    	<?php if ( is_search() ) : ?>
    
    	<?php else : ?>
    
    	<?php endif; ?>

    というような形になっております。
    お忙しい中申し訳ございませんが、よろしくお願いします。

2件の返信を表示中 - 1 - 2件目 (全2件中)
  • トピック投稿者 tak7910

    (@tak7910)

    追記…
    管理画面の設定の表示で投稿の件数を設定した件数と、上のコードで出力した件数が合わないのも原因があるかなと思いました。

    管理画面では1件ずつにしても、件数指定をしていないはずなのに、何故か、6件が出力されてしまいました。

    トップでは6件の箇所もあるのですが。

    トピック投稿者 tak7910

    (@tak7910)

    お世話になりました。自己解決できました。

    原因は、パーマリンク設定をカスタムにして
    ●●.com/カテゴリー名/記事の名前
    という形でURLを組んでいたことがおそらくの原因でした。

    Top Level Categories Fix使ったら一発で直りました。

2件の返信を表示中 - 1 - 2件目 (全2件中)
  • トピック「ページャー設置について」には新たに返信することはできません。