web-dev-qa-db-ja.com

ユーザーがカスタム分類をカスタム分類法のリストに設定できるようにしますか?

私はこれらの弁護士がどのような実践分野に関わっているかを示す個々のバイオ弁護士のページにカスタムカテゴリのチェックボックスを持っています。現在私はそれらをアルファベット順にソートしています。練習領域を選択するときに各弁護士が独自のカスタムオーダーを設定できるようにする方法があるかどうか私は疑問に思います。

これが投稿のスクリーンショットです: https://www.dropbox.com/s/1si99a5elkmdwbr/Screen%20Shot%202013-02-14%20at%2011.50.02%20AM%20copy .png

更新:

興味のある人のために私はそれを考え出した。

これを自分のfunctions.phpに追加しました:

function set_the_terms_in_order ( $terms, $id, $taxonomy ) {
$terms = wp_cache_get( $id, "{$taxonomy}_relationships_sorted" );
if ( false === $terms ) {
    $terms = wp_get_object_terms( $id, $taxonomy, array( 'orderby' => 'term_order' ) );
    wp_cache_add($id, $terms, $taxonomy . '_relationships_sorted');
}
return $terms;
}
add_filter( 'get_the_terms', 'set_the_terms_in_order' , 10, 4 );

function do_the_terms_in_order () {
    global $wp_taxonomies;  //fixed missing semicolon
    // the following relates to tags, but you can add more lines like this for any taxonomy
    $wp_taxonomies['post_tag']->sort = true;
    $wp_taxonomies['post_tag']->args = array( 'orderby' => 'term_order' );    
}
add_action( 'init', 'do_the_terms_in_order');

それから私が私の分類法を登録するとき、私は設定しました:

'hierarchical' => false,        
'orderby' => 'term_order'

クレジット: http://wordpress.kdari.net/2011/07/listing-tags-in-custom-order.html

1
popshuvit

興味のある人のために私はそれを考え出した。

これを自分のfunctions.phpに追加しました:

function set_the_terms_in_order ( $terms, $id, $taxonomy ) {
$terms = wp_cache_get( $id, "{$taxonomy}_relationships_sorted" );
if ( false === $terms ) {
    $terms = wp_get_object_terms( $id, $taxonomy, array( 'orderby' => 'term_order' ) );
    wp_cache_add($id, $terms, $taxonomy . '_relationships_sorted');
}
return $terms;
}
add_filter( 'get_the_terms', 'set_the_terms_in_order' , 10, 4 );

function do_the_terms_in_order () {
    global $wp_taxonomies;  //fixed missing semicolon
    // the following relates to tags, but you can add more lines like this for any taxonomy
    $wp_taxonomies['post_tag']->sort = true;
    $wp_taxonomies['post_tag']->args = array( 'orderby' => 'term_order' );    
}
add_action( 'init', 'do_the_terms_in_order');

それから私が私の分類法を登録するとき、私は設定しました:

'hierarchical' => false,        
'orderby' => 'term_order'

クレジット: http://wordpress.kdari.net/2011/07/listing-tags-in-custom-order.html

1
popshuvit