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 need to create an ul list in a Custom Meta Box.

The content/text area of the post is already taken up with other information.

Is it possible to create another text area like WP built in one so I could us the Unordered list button.

-- EDIT --

I'm not sure how else I can describe this.

I know how to create Custom Meta Boxes. I can create text input fields and textarea fields.

I would like a Custom Meta Box that would output the information in it as an Unordered list on the site.

In WP's textarea in a post I can type text, select it then press the unordered list button to make it into an unordered list.

How can I do this with a Custom Meta Box?

share|improve this question
    
For me, it is not clear what you are trying to achieve, can you explain this in terms of code? –  brasofilo Feb 6 '13 at 17:52

2 Answers 2

You can add your information in regular metabox textarea and separate prospective list items with new line. Then just format it as list in your template:

<?php
$list_items = get_post_meta($post->ID, 'your_custom_field_name', true);
     if($list_items){
        $list_items = explode("\n", $list_items) {
            echo '<ul>';
                foreach($list_items as $list_item)
                    echo '<li>' . $list_item . '</li>';
            echo '</ul>';
        }
    }

Or you can add one more TinyMCE editor (like the one for post text) as described here: Custom fields or something else

share|improve this answer

You can create "Custom Fields" that allow you to add additional information to your post, stored as "post meta".

There are lot of good plugins available to help with this. I suggest you try "Advanced Custom Fields" (http://wordpress.org/extend/plugins/advanced-custom-fields/).

-- Updated --

In response to your added details, you have a few options.

You can add another Visual Editor (using a plugin like Advanced Custom Fields) which would let you use the ordered list tool.

You could also write your content as HTML, using the <ul> and <li> tags accordingly.

Last but not least, though more complex, you can pass your values in as comma separated and then loop through them in the template.

share|improve this answer
    
I tried writing the content as HTML but after I save/publish it the html is removed –  user668499 Feb 6 '13 at 18:08
    
How are you creating the meta boxes? My guess is that the plugin or method you're using is stripping the HTML out. –  Jonathan Wold Feb 6 '13 at 18:09
    
By default html tags are not removed. –  Wyck Feb 6 '13 at 18:36

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.