質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

Q&A

1回答

1316閲覧

WordPressのページングについて質問があります。

leonchan

総合スコア8

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

0グッド

0クリップ

投稿2015/11/25 09:55

WordPressの投稿を出力してページング機能をつけようと試みています。

しかし、このようなバグが発生してしまいなかなか対処できずに困っています。

コードは下記になります。

正しい書き方のご教授をお願い致します。

お手数をおかけしますが、お力をお貸しください。

よろしくお願い致します。

イメージ説明

<div class="blog_holder masonry_full_width masonry_infinite_scroll four_columns"> <div class="blog_holder_grid_sizer"></div> <div class="blog_holder_grid_gutter"></div> <?php $paged = get_query_var(''); ?>
<?php query_posts("posts_per_page=5&paged=$paged"); ?> <?php if (have_posts()) : while(have_posts()) : the_post(); ?> <article id="post-327" class="post-327 post type-post status-publish format-standard has-post-thumbnail hentry category-destination category-food tag-amazing tag-relaxing tag-spa"> <div class="post_image"> <a href="<?php echo get_permalink(); ?>"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'post-thumbnail'); } ?> </a> </a> </div> <div class="post_text"> <div class="post_text_inner"> <div class="post_info"> <div class="date"> Octorber 13, 2015 </div> <div class="post_category noto">カテゴリ <a href="" rel="category tag noto">カテゴリ</a>, <a href="" rel="category tag noto">カテゴリ</a> </div> </div> <h4 class="noto"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> </h4> <p class="post_excerpt noto"> <?/*php the_content(); */?> <?php echo mb_substr(strip_tags($post-> post_content),0,50).'...'; ?> <a href="/archives/<? echo $post->ID; ?>"> &gt;&gt; 記事を表示する</a> <? $length=100; $more='....'; $excerpt=''; /* function my_excerpt_mblength($length) { return 100; } add_filter('excerpt_mblength', 'my_excerpt_mblength'); // 本文からの抜粋末尾の文字列を指定する function my_auto_excerpt_more($more) { return '・・・'; } add_filter('excerpt_more', 'my_auto_excerpt_more'); // 抜粋末尾に個別投稿ページへのリンクを追加する function my_custom_excerpt_more($excerpt) { return $excerpt . '<a href="' . get_permalink($post->ID) . '"> &gt;&gt; 記事を表示する</a>'; } add_filter('get_the_excerpt', 'my_custom_excerpt_more'); */ ?> </p> <div class="read_more_wrapper clearfix"> <div class="blog_social_share_wrapper"> <div class="blog_share"> <div class="social_share_holder"> <a href="javascript:void(0)" target="_self"> <i class="social_share social_share_icon"></i> <span class="social_share_title">Share</span> </a> <div class="social_share_dropdown"> <ul> <li class="facebook_share"> <a class="share_link" href="#" onclick="window.open('http://www.facebook.com/sharer.php?s=100&amp;p[title]=History+of+Brooklyn&amp;p[summary]=No+one+rejects%2C+dislikes%2C+or+avoids+pleasure+itself%2C+because+it+is+pleasure%2C+but+because+those+who+do+not+know+how+to+pursue+pleasure+rationally+encounter+consequences+that+are+extremely+painful.+Nor+again+is+there+anyone+who+loves+or+pursues+or+desires+to+obtain+pain+of+itself.+No+one+rejects%2C+dislikes%2C+or+avoids+pleasure+itself%2C+because+it+is+pleasure%2C+but+because+those+who+do+not+know+how+to+pursue+pleasure+rationally+encounter+consequences+that+are+extremely+painful.&amp;p[url]=http%3A%2F%2Fdemo.elated-themes.com%2Fborderland1%2Fhistory-of-brooklyn-2%2F&amp;p[images][0]=http://demo.elated-themes.com/borderland1/wp-content/uploads/2015/03/bg-history-of-brooklyn.jpg', 'sharer', 'toolbar=0,status=0,width=620,height=280');"> <span class="social_network_icon social_facebook"></span> </a> </li> <li class="twitter_share"> <a class="share_link" href="#" onclick="popUp=window.open('http://twitter.com/home?status=http://demo.elated-themes.com/borderland1/history-of-brooklyn-2/', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false;"> <span class="social_network_icon social_twitter"></span> </a> </li> <li class="google_share"> <a class="share_link" href="#" onclick="popUp=window.open('https://plus.google.com/share?url=http%3A%2F%2Fdemo.elated-themes.com%2Fborderland1%2Fhistory-of-brooklyn-2%2F', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false"> <span class="social_network_icon social_googleplus"></span> </a> </li> <li class="tumblr_share"> <a class="share_link" href="#" onclick="popUp=window.open('http://www.tumblr.com/share/link?url=http%3A%2F%2Fdemo.elated-themes.com%2Fborderland1%2Fhistory-of-brooklyn-2%2F&amp;name=History+of+Brooklyn&amp;description=No+one+rejects%2C+dislikes%2C+or+avoids+pleasure+itself%2C+because+it+is+pleasure%2C+but+because+those+who+do+not+know+how+to+pursue+pleasure+rationally+encounter+consequences+that+are+extremely+painful.+Nor+again+is+there+anyone+who+loves+or+pursues+or+desires+to+obtain+pain+of+itself.+No+one+rejects%2C+dislikes%2C+or+avoids+pleasure+itself%2C+because+it+is+pleasure%2C+but+because+those+who+do+not+know+how+to+pursue+pleasure+rationally+encounter+consequences+that+are+extremely+painful.', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false"> <span class="social_network_icon social_tumblr"></span> </a> </li> <li class="pinterest_share"> <a class="share_link" href="#" onclick="popUp=window.open('http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fdemo.elated-themes.com%2Fborderland1%2Fhistory-of-brooklyn-2%2F&amp;description=History of Brooklyn&amp;media=http%3A%2F%2Fdemo.elated-themes.com%2Fborderland1%2Fwp-content%2Fuploads%2F2015%2F03%2Fbg-history-of-brooklyn.jpg', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false"> <span class="social_network_icon social_pinterest"></span> </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div>
</article>
<?php endwhile; ?> <?php else: ?> <?php endif; ?>
<div class="pnbt-area"> <strong>1</strong> <a class="float" href="/content/&per_page=15">2</a> <a class="float" href="/content/&per_page=15">></a> </div>
</div> <div class="blog_infinite_scroll_button"> <span data-rel="3"> <a href="http://demo.elated-themes.com/borderland1/blog-masonry/page/2/">Show more</a> </span> </div> </div> </div>
</div> <!-- close div.content_inner --> </div> <!-- close div.content --> </div> <!-- paspartu_inner close div --> </div> <!-- paspartu_outer close div --> <?/* <div class="pagination"><span>Page 1 of 3</span><span class="current">1</span><a href='http://vt1.glnabi.com/blog/2' class="inactive">2</a><a href='http://vt1.glnabi.com/blog/3' class="inactive">3</a></div> */?> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

まず、圧倒的に情報が足りません。
PHPのバージョンやWordPressのバージョンすらわかりません。

・エラーメッセージ画像は小さくて見えないし、読めない
・ソースはせめてコードタグで囲んでください。
・ページングが効かないのはquery_postsを使っているからでは?

投稿2015/11/26 00:05

ucan-lab

総合スコア888

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問