0
カスタムの投稿タイプとカスタム分類が作成されました。分類法では、ソート順のフィールドがあります。ソート順が空のままであれば、商品カテゴリは表示されません。並べ替え順序に関連するコードはこれです。ソート順が空の場合、商品が表示されません。
コードこれまで特定のカテゴリのソート順は、それが示されていない空のままに
$term = get_term($product, 'product-cat',array('parent' => 0,'hide_empty'=> true));
if($counter==0){
$check=$term->parent;
$counter=1;
}
if($check==$term->parent)
{
$prod_meta = get_option("taxonomy_term_".$term->term_id);
echo $prod_meta['parent'];
$prod_meta['img'] = strstr($prod_meta['img'], '/wp-content');
$sorted_products[$prod_meta['sort_order']] = array(
'name' => $term->name,
'link' => get_term_link($product),
'term_id' => $term->term_id,
'img' => $prod_meta['img']);
}
else{
}
}
ksort($sorted_products);
を呼び出すためのソート順
<tr class="form-field">
<th scope="row" valign="top"><label for="cat_sort_order"><?php _e('Product Sort Order'); ?></label></th>
<td>
<input id="banner-url" name="term_meta[sort_order]" type="text" style="width: 100%;" value="<?php echo $term_meta['sort_order'] ? $term_meta['sort_order'] : ''; ?>" />
<span class="description"><?php _e(' '); ?></span>
</td>
</tr>
機能のために。ソート順のデフォルト値を0にします。
@dingo_d親切に私をここに案内してください –
@TeeDeJee親切に私をここに案内します –