What you’re trying to do can be accomplished without ever editing the core files in OptionTree. Add your custom option type functions to your themes functions.php
and the following code, as well.
/**
* Filter to add custom option types.
*
* @param array An array of option types.
* @return array
*/
function add_custom_option_types( $types ) {
$types['post_select_a_1'] = 'Post Select option type. (_a_1)';
$types['post_select_a_2'] = 'Post Select option type. (_a_2)';
$types['post_select_a_3'] = 'Post Select option type. (_a_3)';
$types['post_select_a_4'] = 'Post Select option type. (_a_4)';
$types['post_select_a_5'] = 'Post Select option type. (_a_5)';
$types['post_select_a_6'] = 'Post Select option type. (_a_6)';
return $types;
}
add_filter( 'ot_option_types_array', 'add_custom_option_types' );
This will auto load your functions into OptionTree and you don’t need to edit any of the core files. When you add new options, there are two requirements. One, all functions must be prepended with ot_type_
. Two, when adding to the array of options your new array keys need to match the function name minus ot_type_
, you can use either -
or _
when creating the key. So if you have a custom function named ot_type_super_awesome
you could add it to the filtered array with either:
$types['super_awesome'] = 'Super Awesome';
or
$types['super-awesome'] = 'Super Awesome';
I hope that clears up any confusion. On a side note there are two ot_type_post_select_a_5
in the file you created and I’m assuming the last one should be ot_type_post_select_a_6
. Cheers!