1

私はショートコードAPI関数を書いています。wp_dropdown_categoriesから選択した値を保存して、その値を で使用したいと考えていますwp_query

echo `<form action="" method="POST">`;
  $values = array(
    `orderby` => `name`, 
    `order` => `ASC`,
    `echo` => 1,
    `selected` => $kat = get_query_var( `cat` ),
    `name` => 'cat',
    `id` => ``,
    `taxonomy` => `persons`
  );
  wp_dropdown_categories( $values );
 echo `<input type="submit" name="submit" value="view" />;
echo `</form>`;

選択した値を使用してカスタム分類を検索したい

$args = array(
  `post_type` => `client`,
  `persons` => `here selected value from wp_dropdown_categories`
);
$my_query = new WP_Query( $args );

if( $my_query->have_posts() ) {
  echo `Name: `;
  while ($my_query->have_posts()) : $my_query->the_post();
  echo the_title();
  endwhile;
}
4

1 に答える 1