Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mytheme_show_box2() {
- global $meta_box2, $post;
- echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
- echo '<table class="form-table">';
- foreach ($meta_box2['fields'] as $field) {
- // get current post meta data
- $meta = get_post_meta($post->ID, $field['id'], true);
- // let's get all the posts with custom post type 'papirutgave'
- $myOptions = get_selectList_options('papirutgave');
- // let's check if any old data is saved or not
- $oldData = get_post_meta($post->ID,'tilknyttet_papirutgave',true);
- echo '<tr>',
- '<td>';
- echo '<select name="', $field['id'], '" id="', $field['id'], '">';
- if($myOptions->have_posts()){
- if(!$oldData){
- echo '<option value="">Velg papirutgave</option>';
- }
- while ( $myOptions->have_posts() ) : $myOptions->the_post();?>
- <option <?php if($oldData && $oldData == get_the_title()){echo 'selected';}?>><?php the_title()?></option>
- <?php
- endwhile;
- }
- wp_reset_query();
- echo '</select>';
- }
- echo '<td>',
- '</tr>';
- echo '</table>';
- }
Add Comment
Please, Sign In to add comment