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.

I am working in a WordPress backend design and I would like to know if is there any function like wp_categories_checklist but for posts.

I have an issue here: http://wordpress.org/support/topic/order-posts-by-custom-post-type-in-dropdown-field?replies=10 in order to find a multiple selection of my dropdown. So if is there any way to put my posts array in a meta box like the custom categories from WordPress that would be great.

Thanks

share|improve this question
    
Your question seems to have been answered at wordpress.org/support What wasn't answered in that thread? Post all the relevant information here please. –  s_ha_dum Jun 5 '13 at 12:41
    
Hi s_ha_dum. I've not solved the problem yet. When I get the right code I'll put the answer here :) –  Luismin Jun 7 '13 at 7:35
    
So, again, post all the relevant information here please. And explain what isn't solved by that support thread. As is, this is not much of a question, which I'd guess is why there hasn't been much of a response. –  s_ha_dum Jun 7 '13 at 13:01

1 Answer 1

up vote 0 down vote accepted
{// post_list  
case 'post_list_produktkrav': 

$items = get_posts( array (  
                                'post_type' => $field['post_type'],  
                                'posts_per_page' => -1  
)); 
foreach($items as $item) {
echo '<input type="checkbox" value="'.$item->ID.'" name="'.$field_related['id'].'[]" id="'.$item->ID.'"',$meta_related && in_array($item->ID, $meta_related) ? ' checked="checked"' : '',' />  
<label for="'.$item->ID.'">'.$item->post_title.'</label><br />';  
} // end foreach

break;}
share|improve this answer
    
By adding this I can display a list of checkboxes and choose one or more. –  Luismin Jun 10 '13 at 6:38
    
Whatever this is – it is not an answer. Please improve this fragment. How to Answer Thank you. –  toscho Jun 10 '13 at 6:42
    
I can't put all the code here because is too long. Maybe a pastebin link it's enough: [link]pastebin.com/mW3ZssJ9 :) –  Luismin Jun 11 '13 at 6:27
    
Add an explanation to your answer. Why does it solve the problem? No need to post more long code blocks. –  toscho Jun 11 '13 at 6:31

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.