kazuyoung
フォーラムへの返信
5件の返信を表示中 - 1 - 5件目 (全5件中)
-
フォーラム: 使い方全般
返信が含まれるトピック: 固定ページの投稿入力からfunctionの関数を呼び出したいおかげさまで自力解決ができました。
無駄なwhile文とif文を削除して、
if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); }
上記の文の「$additional_loop->max_num_pages」を
「$the_query->max_num_pages」に変更したらページネーション(ページ送り?)が表示されました。<?php $paged = (int) get_query_var('paged'); $args = array( 'posts_per_page' => 10, 'paged' => $paged, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish' ); $the_query = new WP_Query($args); while ( $the_query->have_posts() ) : $the_query->the_post(); get_template_part('content-archive'); endwhile; wp_reset_postdata(); //pager if (function_exists("pagination")) { pagination($the_query->max_num_pages); } ?>
フォーラム: 使い方全般
返信が含まれるトピック: 固定ページの投稿入力からfunctionの関数を呼び出したいコメントありがとうございます。
セキュリティ面で懸念があることを初めて知りました。
page-投稿スラッグ名.phpで対応する事にいたしました。とりあえず投稿画面では何も入力せず、テンプレートに以下のコードを入力してみました。
結論から申し上げるとやはりページ送りは表示されませんでした。。他の一覧ページは表示できているのに、なぜだか考えが及びません。
<div id="main"> <?php while(have_posts()): the_post(); ?> <!-- <?php the_content(); ?> --> <?php $paged = (int) get_query_var('paged'); $args = array( 'posts_per_page' => 10, 'paged' => $paged, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish' ); $the_query = new WP_Query($args); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); get_template_part('content-archive'); endwhile; else: echo "none"; endif; wp_reset_postdata(); //ここにpager関数を入れたいです if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?> <?php endwhile; ?> </div><!--/main-->
フォーラム: 使い方全般
返信が含まれるトピック: カテゴリーページで特定の記事のみ除外したいフォーラム: 使い方全般
返信が含まれるトピック: カテゴリーページで特定の記事のみ除外したいなるほど、そうなんですね。
ということは、function.phpにいろいろと他に記述しているコードと干渉してる可能性があるのでしょうか。フォーラム: 使い方全般
返信が含まれるトピック: カテゴリーページで特定の記事のみ除外したい
5件の返信を表示中 - 1 - 5件目 (全5件中)