You can create a basic theme options page using the WordPress settings api
Here is a simple example that will create an input field for the user to enter a path to the custom logo.
// Add a menu for our option page
add_action('admin_menu', 'prefix_myplugin_add_page');
function prefix_myplugin_add_page() {
add_options_page( 'My Theme Options', 'Theme Name Options', 'manage_options', 'prefix_mytheme', 'prefix_myplugin_option_page' );
}
// Draw the option page
function prefix_mytheme_option_page() {
?>
<div class="wrap">
<h2>Really Simple Google Analytics</h2>
<form action="options.php" method="post">
<?php settings_fields( 'prefix_mytheme_options' ); ?>
<?php do_settings_sections( 'prefix_mytheme' ); ?>
<input name="Submit" type="submit" value="Save Changes" />
</form>
</div>
<?php
}
// Register and define the settings
add_action( 'admin_init', 'prefix_mytheme_admin_init' );
function prefix_mytheme_admin_init(){
register_setting(
'prefix_mytheme_options',
'prefix_mytheme_options'
);
add_settings_section(
'prefix_mytheme_main',
'prefix_mytheme_options',
'prefix_mytheme_section_text',
'prefix_mytheme'
);
add_settings_field(
'prefix_mytheme_text_string',
'Enter text here',
'prefix_mytheme_setting_input',
'prefix_mytheme',
'prefix_mytheme_main'
);
}
// Draw the section header
function prefix_mytheme_section_text() {
echo '<p>Enter path to custom logo.</p>';
}
// Display and fill the form field
function prefix_mytheme_setting_input() {
// get option 'text_string' value from the database
$options = get_option( 'prefix_mytheme_options' );
$text_string = $options['text_string'];
// echo the field
echo "<input id='text_string' name="prefix_mytheme_options[text_string]" type="text" value="$text_string" />";
}
Calling the custom logo option in your header.php file:
$options = get_option( 'prefix_mytheme_options' );
if ( ! empty( $options['text_string'] ) ) {
$logo = $options['text_string'];
} else { $logo = 'http://path_to_default_logo';
}