Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function jjm_add_custom_box(){
- add_meta_box(
- 'jjm_concert_box_id', // Unique ID
- 'concert toevoegen', // Box title
- 'jjm_custom_box_concert_html', // Content callback, must be of type callable
- 'concert' // Post type
- );
- add_meta_box(
- 'jjm_artiest_box_id', // Unique ID
- 'Voeg een nieuwe artiest toe', // Box title
- 'jjm_custom_box_artiest_html', // Content callback, must be of type callable
- 'artiest' // Post type
- );
- add_meta_box(
- 'jjm_zaal_box_id', // Unique ID
- 'zaal toevoegen', // Box title
- 'jjm_custom_box_zaal_html', // Content callback, must be of type callable
- 'zaal' // Post type
- );
- add_meta_box(
- 'jjm_concert_zaal_box_id', // Unique ID
- 'Koppel zaal', // Box title
- 'jjm_custom_box_concert_zaal_html', // Content callback, must be of type callable
- 'concerts' // Post type
- );
- }
- function jjm_custom_box_concert_zaal_html($post){
- $value_gekoppelde_zaal_id = get_post_meta($post->ID,'_concert_zaal', true);
- print("<h1>Koppel concert met zaal</h1>");
- $zalen = get_all_of_post_type('zaal');
- foreach($zalen as $zaal){
- print("<input type='radio' name='concert_zaal' value='" . $zaal->ID . "' " .
- ($zaal->ID == $value_gekoppelde_zaal_id ? "checked": "") . ">". $zaal->post_title ."</input>");
- }
- }
- function get_all_of_post_type( $type_name = '') {
- $items = array();
- if ( !empty( $type_name ) ) {
- $args = array(
- 'post_type' => "{$type_name}",
- 'posts_per_page' => -1,
- 'order' => 'ASC',
- 'orderby' => 'title'
- );
- $results = get_posts( $args );
- }
- return $results;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement