カスタム投稿のtaxonomyをラジオボタンに変更
- 2016.11.08
- CMS Wordpress
- taxonomy, カスタムタクソノミー, 管理画面
下記では「hogehoge_tax」「sample_tax」「hugahuga_tax」の3つのカスタム投稿のタクソノミー選択をラジオボタンに変更している。
// カスタム投稿のカテゴリーをラジオボタンに変更
function my_print_footer_scripts() {
echo '<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
$("#hogehoge_taxchecklist input[type=checkbox]").each(function(){
$check = $(this);
$(this).replaceWith($(this).clone().attr("type","radio"));
});
$("#sample_taxchecklist input[type=checkbox]").each(function(){
$check = $(this);
$(this).replaceWith($(this).clone().attr("type","radio"));
});
$("#hugahuga_taxchecklist input[type=checkbox]").each(function(){
$check = $(this);
$(this).replaceWith($(this).clone().attr("type","radio"));
});
});
//]]>
</script>';
}
add_action('admin_print_footer_scripts', 'my_print_footer_scripts', 21);
-
前の記事
(記事修正中)遷移元で表示を変更する 2016.11.08
-
次の記事
カスタムフィールドのチェックボックスにチェックが入っていたら出力 2016.11.08