結局ブログのYARPPはやめて
車で出したかったので
ステータスをタクソノミーに変更
変更方法は
アドバンスでcar_openに作ったタクソノミーを割り当てる。
返り値はID
IDは順に数値がおおきくなるため、
販売受付中
SOLDOUTと順につくれば
並び順は
ASC となる。
真ん中に新しい項目 交渉中など入れたい場合は
SOLD OUTを一度消して、
作り直す必要が出てくるので
注意
<?php //公開状態
$hoge = get_field('car_open');
if($hoge == '10'):
elseif($hoge == '189'):
?>
という表示方法
IDに変えただけ
ファンクションの
メインクエリは
$meta_query = array(
'relation' => 'AND', //meta_queryの配列が1つの時は指定しない
'meta_sort1' => array(
'key' => 'car_open', //キー
'type' => 'NUMERIC', //タイプ 数字
),
'meta_sort2' => array(
'key' => 'car_cc', //キー
'type' => 'NUMERIC', //値のタイプ 数字
));
$orderby = array(
'meta_sort1' => 'ASC',
'meta_sort2' => 'ASC',
// 'date' => 'DESC'
);
$query->set('meta_query', $meta_query);
$query->set('orderby', $orderby);
結局 ‘meta_sort1’ => ‘ASC’,にへんこうしただけ
yarpp 直書きの場合はタクスとかないとエラーで表示されないからきお
http://blog.k-kansei.com/?p=728
http://www.ex-tra.jp/kosukekato/archives/15420
オプション
yarpp_related(array(
// Pool options: these determine the "pool" of entities which are considered
'post_type' => array('post', 'page', ...),
'show_pass_post' => false, // show password-protected posts
'past_only' => false, // show only posts which were published before the reference post
'exclude' => array(), // a list of term_taxonomy_ids. entities with any of these terms will be excluded from consideration.
'recent' => false, // to limit to entries published recently, set to something like '15 day', '20 week', or '12 month'.
// Relatedness options: these determine how "relatedness" is computed
// Weights are used to construct the "match score" between candidates and the reference post
'weight' => array(
'body' => 1,
'title' => 2, // larger weights mean this criteria will be weighted more heavily
'tax' => array(
'post_tag' => 1,
... // put any taxonomies you want to consider here with their weights
)
),
// Specify taxonomies and a number here to require that a certain number be shared:
'require_tax' => array(
'post_tag' => 1 // for example, this requires all results to have at least one 'post_tag' in common.
),
// The threshold which must be met by the "match score"
'threshold' => 5,
// Display options:
'template' => , // either the name of a file in your active theme or the boolean false to use the builtin template
'limit' => 5, // maximum number of results
'order' => 'score DESC'
),
$reference_ID, // second argument: (optional) the post ID. If not included, it will use the current post.
true); // third argument: (optional) true to echo the HTML block; false to return it
メーカーが更新後トヨタにもどってしまう(何も選択されない)は
その他のアドバンスカスタムで分岐条件でつかっていたからかもしれない
そこをcarにインサートされないようにしたら治った。