Hi guys,
What I'm trying to do is convert an array that is currently hard coded, into one that is algorithmic and will dynamically change based on the number of pages on my site with the specified template. The array is a list of options that are to appear in a drop down menu.
Hard code where 'Portraits' => __( 'Portraits', 'quemalabs_admin') is output => __(option title,
function) :
'options' => array( 'Portraits' => __( 'Portraits', 'quemalabs_admin'), 'Concerts' => __( 'Concerts', 'quemalabs_admin' ), )
Here is what I have as the algorithmic code. This code currently outputs the correct number of options, however all of the titles display as "Array"
$pages = get_pages(array( 'meta_key' => '_wp_page_template', 'meta_value' => 'page-home.php' )); foreach($pages as $page){ $keys[] = $page->post_title.'<br />'; } $objects = array_fill_keys($keys, 'quemalabs_admin'); $options = array_fill_keys($keys, $objects);
...
'options' => $options