絞り込み検索+ページネーションを合わせて実装する際に、URLが
ページURL / 検索パラメータ / ページネーション
の並びとなり、うまくページ送りがうまく動作せず、URLを
ページURL / 検索パラメータ / ページネーション
に並び変えたいのですが知識不足で並び替えをすることができません。
大変恐縮ですがご指導頂けますと幸いです。
<ul> <?php $paged = (int) get_query_var('paged'); ?> <?php $query_args = array( 'post_type' => '___', 'posts_per_page' => 40, 'orderby' => 'date', 'order' => 'DESC', 'paged' => $paged, 'tax_query' => array( array( 'relation' => 'AND', array( 'taxonomy' => '___', 'terms' => $_page['___'], 'field' => 'slug', 'operator' => 'IN' ), ), ), 'meta_query' => array( 'relation' => 'AND', ), ); if ($_GET['___']) { $query_args['meta_query'][] = array( 'key' => '___', 'value' => $_GET['___'], 'compare'=>'=' ); } if ($_GET['___']) { $query_args['meta_query'][] = array( 'key' => '___', 'value' => $_GET['__'], 'compare'=>'=' ); } if ($_GET['___']) { $query_args['meta_query'][] = array( 'key' => '___', 'value' => $_GET['___'], 'compare'=>'like' ); } $query = new WP_Query($query_args); $the_query = new WP_Query($query_args); if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); $dress_tags = get_the_terms($post->ID, '___'); ?> <?php $postid = get_the_ID(); ?> ループ内容 <?php endwhile; endif; ?> </ul> ・ ・ ・ <div class="pagenation clearfix"> <?php if ($the_query->max_num_pages > 1) { echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => 'page/%#%/', 'current' => max(1, $paged), 'total' => $the_query->max_num_pages )); } wp_reset_postdata(); ?> </div>
あなたの回答
tips
プレビュー