WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am making theme for hotel and i made custom metabox with list of various custom fields that i would need in posts.

What i did is i made a list of fields like

  • booking
  • wifienabled
  • coffe
  • pool
  • spa

and so on...

Problem is that currently i can show those custom fields in website frontend only by order how i added them in array, if i change places in my list custom fields will change places in website frontend.

Is it possible that custom fields have specific order? Some kind of drag and drop to rearange those fields and change order of display in frontend?

share|improve this question
up vote 1 down vote accepted

In this example of repeatable custom fields, we can see that the following jQuery is needed:

$('#repeatable-fieldset-one tbody').sortable({
    opacity: 0.6,
    revert: true,
    cursor: 'move',
    handle: '.sort'

And the HTML it controls is (simplified):

<table id="repeatable-fieldset-one" width="100%">
        <th width="2%"></th>
        <th width="30%">Name</th>
        <th width="60%">URL</th>
        <th width="2%"></th>
if ( $repeatable_fields ) :
    foreach ( $repeatable_fields as $field ) {
            <td><a class="button remove-row" href="#">-</a></td>
            <td>NAME FIELD</td>
            <td>URL FIELD</td>
            <td><a class="sort">|||</a></td>
share|improve this answer
This is great, not exactly what i had in mind, i just wanted to be able to reorder my fields, but this is even better, i added select box to this and now i can add multiple fields. Like coffee text outside, coffee text inside. Thanks alot you helped so much. – Aleksandar Đorđević Feb 7 '13 at 10:31
One stupid question. How do i display this list in my theme? – Aleksandar Đorđević Feb 7 '13 at 10:59
Glad it helped! In the theme use get_post_meta and you'll have an array with the values. – brasofilo Feb 7 '13 at 13:36
I got it working, i just didn't realized at first that it has an array inside an array of list. – Aleksandar Đorđević Feb 7 '13 at 13:49
How do i add radio buttons list to this ? – Aleksandar Đorđević Feb 7 '13 at 23:04

Your Answer


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.