Multiple arrays in one admin option from theme options page.
-
I am trying to create a multidimensional array in the wordpress database from the options pages. I have the form tag
<form action=”options.php” post=”post”>
I get the options by<?php settings_fields( 'theme_styles' ); ?> <?php $options = get_option( 'theme_styles_options' ); ?>
I have a field
<input type="text" id="theme_styles_options[option_name]" name="theme_styles_options[option_name]" class="regular-text" value="<?php esc_attr_e( $options[option_name] ); ?> />
I would like to be able to have this field multiple times but under different arrays e.g.
array( 'first_array' => array( 'option_name' => 'value1' ) 'second_array' => array( 'option_name' => 'value2' ) )
I know at the moment it my current code saves as
array( 'option_name' => 'value1' )
How to I set my field to send the value to the options.php page to be saved as a multidimensional array? Also, if someone knows how to save it, how to I retrieve it from the field in the database?
Many Thanks
- The topic ‘Multiple arrays in one admin option from theme options page.’ is closed to new replies.