Creating Theme Options - AgriLife/AgriFlex GitHub Wiki

The AgriFlex theme makes use of the Options Framework developed by Devin Price. The Options Framework makes it simple to add and retrieve theme options with little coding on our part.

We have extended the framework to allow developers to create additional options via a filter agriflex_add_options. Here's how to do it:

add_filter( 'agriflex_add_options', 'test_options', 10 );
function test_options( $new_options ) {

  $new_options[] = array(
    'name' => __( 'Test Tab', 'plugin_namespace' ),
    'type' => 'heading',
  );
  $new_options[] = array(
    'name' => __( 'Test field', 'plugin_namespace' ),
    'id' => 'test-field',
    'type' => 'text',
  );

  return $new_options;

}

Your new options will then be parsed and included in the Theme Options page. Here's the result:

As you can see, the new tab and field now appear after the default options.

Please take a look at the sample options page to learn the various field types.