Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Simple you will say?

I have a first Custom post type called Country. I have a second Custom post type called Travellers. I need to make a drop down select list (multiple check) available when editing Countrywith content from Travellers. This will allow me to select travellers for each country.

Help!

thx in advance

share|improve this question
    

3 Answers 3

very simeler to the question here Display list of tags as drop down menu or radio buttons in a meta box?

but instead of list of tags you need to query the post list of your travellers post type something like this:

$travelers = new WP_Query();
$travelers ->query('post_type=travelers&postprepage=-1');
while ($travelers->have_posts()) : 
   $recentPosts->the_post();
   $travellersnames[] = $post->title;
endwhile

and show the $travellersnames as your option for a select filed or multi select filed in your meta box

share|improve this answer
    
Thanks for your guidance. –  salocin Jan 24 '11 at 17:09
    
glad i can help –  Bainternet Jan 24 '11 at 17:12

Following the answer I ended up with

$s_query = new WP_Query( array(
    'suppress_filters' => false,
    'post_type' => 'slide'));
while($s_query->have_posts()):$s_query->the_post();

    $sname = $post->post_title;
    $s_output2 ='';
    $s_output2 .= '<option value="'.$post->ID.'" >';
    $s_output2 .= $post->post_title;
    $s_output2 .= '</option>';
    echo $s_output2;

endwhile ;
wp_reset_query();
share|improve this answer

I am trying to accomplish this same thing, but the code here is not working for me... is the syntax all correct? I have a basic working knowledge of PHP, but I can't tell what's going on here.

Perhaps some clarification?

Thanks in advance!

share|improve this answer
    
My original question: wordpress.stackexchange.com/questions/7462/… –  user2655 Jan 24 '11 at 21:38
    
Hi ben, the code works by querying a custom taxonomy , in my example slide. May be paste your code and let see if we can help –  salocin Jan 25 '11 at 8:09
    
Ben, please do not use an Answer to ask a question. Either start a new question, or post a comment (either to the OP here, or to one of the answers). Once you've done that please delete your answer here. –  tnorthcutt Jan 25 '11 at 13:19
    
Sorry about that! I hesitated at first but this thread would not allow me to comment on previous answers for some reason. I see the last answer has been reformatted placing the code in the code box, so I'll mess with that and delete this answer... –  user2655 Jan 25 '11 at 17:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.