logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

This is an old version of this question!

Return to the current question

$7
Multiple Fields for One Item on Theme Options Page

I have a theme options page, this one, and I'm trying to edit it so that i can have multiple fields for a single item/row with a mix of select and text fields. In addition I'm trying to have an add more and delete item buttons so that I can just add more instantly. See my image example. Any ideas how to make it work with the options page?

----- EDIT ------
I may have found the answer by using this instead: http://wptheming.com/options-framework-plugin/ ....I've tested and it works from this framework.

HOWEVER

I still need help making the new set of multiple fields dynamically add/delete. So here's my working code for the case.

		case 'filmcredit':	
$film_stored = $val;

$output .= '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][filmyear]' ) . '" id="' . esc_attr( $value['id'] . '_filmyear' ) . '">';
for ($i = 2011; $i > 1949; $i--) {
$filmyear = $i;
$output .= '<option value="' . esc_attr( $filmyear ) . '" ' . selected( $film_stored['filmyear'], $filmyear, false ) . '>' . esc_html( $filmyear ) . '</option>';
}
$output .= '</select>';
$theroles_array = array("" => "Role","Actor/Actress" => "Actor/Actress","Reality Participant" => "Reality Participant","Dancer" => "Dancer","Model" => "Model","Singer" => "Singer");
$output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . '][filmrole]' ) . '" id="' . esc_attr( $value['id'] . '_filmrole' ) . '">';
foreach ($theroles_array as $key => $theroles ) {
$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $film_stored['filmrole'], $key, false ) . '>'. $theroles .'</option>';
}
$output .= '</select>';
$output .= '<input id="' . esc_attr( $value['id'] . '_filmproduction' ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . '][filmproduction]' ) . '" type="text" value="' . esc_attr( $film_stored['filmproduction']) . '" />';

break;

attachment image View Attachment

Jon Stephen | 11/22/11 at 5:31pm

This is an old version of this question!

Return to the current question