Basically I would like to create a function that will in turn create a multidimensional array based on another function. Here's the format of the array I need to create (end result):
'options' => array (
'one' => array (
'label' => 'Option One',
'value' => 'one'
),
'two' => array (
'label' => 'Option Two',
'value' => 'two'
),
'three' => array (
'label' => 'Option Three',
'value' => 'three'
)
)
This will need to be created by a function using another array that was created to store wordpress categories:
$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
$wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}
And here's the code I wrote to try accomplish what I've described but couldn't get it to work:
function wcat2() {
$i = 0;
$categories = get_categories();
foreach( $categories as $category ) {
$i++;
array (
$i => array (
$category->slug => $category->slug,
$category->term_id => $category->term_id
),
);
}
}
Any ideas of what I'm missing? Help would be much appreciated.
Update: Here's an illustration of what I need:

