• I’m trying to create a select field that displays all of the images in a directory. I’m using cusotm metaboxes to display the select box in the backend. I can generate an array of all the images in the directory, I just don’t know how to get the values from that array into select options. here’s my code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Any thoughts or help would be greatly appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter shagdirty

    (@shagdirty)

    quick update, I’ve utilized the implode() function to get the array values into a nice comma separated format but the entire array appears as one option in the select field:

    so I added this:

    $InArray = '\'' . implode('\', \'', array_map('mysql_real_escape_string', $in_list)) . '\'';

    which will display the array in a nice comma separated list when echoed but when placed in my fields array all of the array values appear as one option rather than separate

    'options' => array('default option', $InArray)

    Thoughts on why the options don’t appear separate???

    Thread Starter shagdirty

    (@shagdirty)

    bump. anyone?

    Shagdirty,

    I am trying to achieve the same thing, how did you go?

    Thread Starter shagdirty

    (@shagdirty)

    Actually, I never resolved the issue. I ended up going with a different solution due to time constraints. It seems like I was very close but I’m not supper savvy with arrays.

    I’d still like to know how so if you figure it out please post back.

    shag

    Not yet Shag, I’m still working on a solution – not being supper savvy with arrays myself!

    This is one of those integrations that I have NOT seen anywhere else for a WP installation yet and would be a nice added feature when developing sites for clients who have this requirement.

    Keep you posted..

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display an array in a custom meta box select field’ is closed to new replies.