Adding Theme Option

In theme-options.php —

<?php
add_action(‘admin_init’, ‘custom_theme_options’, 1 );
function custom_theme_options() {
$saved_settings = get_option(‘option_tree_settings’, array() );
$custom_settings = array(
‘sections’ => array(
array(
‘id’ => ‘member’,
‘title’ => ‘Member’
),
array(
‘id’ => ‘contact’,
‘title’ => ‘Contact’
)

),
‘settings’ => array(
array(
‘id’ => ‘s_a1’,
‘label’ => ‘Twitter :’,
‘type’ => ‘tab’,
‘section’ => ‘social’
),
array(
‘id’ => ‘s_ax1’,
‘label’ => ‘Write Twitter Link :’,
‘type’ => ‘text’,
‘section’ => ‘social’
),
array(
‘id’ => ‘s_ay1’,
‘label’ => ‘Upload Picture :’,
‘type’ => ‘upload’,
‘section’ => ‘social’
),

)
);

if (
$saved_settings !== $custom_settings ) {
update_option(‘option_tree_settings’, $custom_settings );
}
}

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: