MW WP Form(チェックボックスの場合)
1 |
[mwform_checkbox name="mwform_item" class="mwform_item"] |
functions.php
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function add_item_list( $children, $atts ) { if ( 'item' == $atts['name'] ) { $items = get_posts( array( 'post_type' => 'item',//カスタム投稿タイプのスラッグ 'posts_per_page' => -1, ) ); foreach ( $items as $item ) { $children[$item->post_title] = $item->post_title; } } return $children; } add_filter( 'mwform_choices_mw-wp-form-xx', 'add_item_list', 10, 2 ); |
コメント