Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $args = array(
- 'post_type' => 'agent',
- 'posts_per_page' => -1
- );
- $agencies = get_posts( $args );
- if( !empty($agencies) ){ ?>
- <select>
- <option value="">Please select</option>
- <?php foreach( $agencies as $agency ){ ?>
- <option <?php selected( get_option('id_agency'), $agency->ID, true ); ?> value="<?php echo $agency->ID; ?>">
- <?php echo $agency->post_title; ?>
- </option>
- <?php } ?>
- </select>
- <?php }else{ echo 'No agencies found'; } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement