前提・実現したいこと
Wordpressサイトでpre_gets_postsを使いたいです。
function.phpに同じ内容を記述したいのですが書き方がわかりません。
教えていただけると嬉しいです。
書き換えたいところ
<?php $s = $_GET['s']; $catnum = $_GET['catnum']; $post_tag = $_GET['post_tag']; //tax_query用 if($catnum){ $taxquerysp[] = array( 'taxonomy'=>'category', 'terms'=> $catnum, 'include_children'=>false, 'field'=>'term_id', 'operator'=>'AND' ); } //tax_query用 if($post_tag){ $taxquerysp[] = array( 'taxonomy'=>'post_tag', 'terms'=> $post_tag, 'include_children'=>false, 'field'=>'slug', 'operator'=>'AND' ); } ?>
ループの始まり
<?php query_posts( array( 'tax_query' => $taxquerysp, 's' => $s, 'paged' => $paged, ) ); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
あなたの回答
tips
プレビュー