<?php /* functions.php */
function display_theme_panel_fields()
{
add_settings_section('settings_html_fields', 'Theme Options', null, 'theme_options');
add_settings_field('theme_phone_number', 'Phone Number', 'display_phone_element', 'theme_options', 'settings_html_fields');
add_settings_field('customtheme_logo', 'Website Logo', 'display_logo_element', 'theme_options', 'settings_html_fields');
add_settings_field("twitter_url", "Twitter Profile Url", "display_twitter_element", "theme_options", "settings_html_fields");
add_settings_field("facebook_url", "Facebook Profile Url", "display_facebook_element", "theme_options", "settings_html_fields");
add_settings_field("address_info", "Mailing Address", "display_address_element", "theme_options", "settings_html_fields");
add_settings_field("fax_number", "Fax Number", "display_fax_element", "theme_options", "settings_html_fields");
register_setting("settings_html_fields", "twitter_url");
register_setting("settings_html_fields", "facebook_url");
register_setting("settings_html_fields", "address_info");
register_setting("settings_html_fields", "fax_number");
register_setting('settings_html_fields', 'theme_phone_number');
register_setting("settings_html_fields", "customtheme_logo", ); // callback can be passed here, but i've tried uncertain what to do with that as Ive tried and didnt help
}
add_action("admin_init", "display_theme_panel_fields");
function customtheme_my_admin_menu()
{
$page_title = 'Theme Settings Page';
$menu_title = 'Theme Settings';
$capability = 'edit_posts';
$menu_slug = 'theme_options';
$function = 'customtheme_theme_settings_page';
$icon_url = '';
$position = 110;
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position);
}
add_action('admin_menu', 'customtheme_my_admin_menu');
function display_phone_element()
{
?>
<input type="text" name="theme_phone_number" id="theme_phone_number"
value="<?php echo get_option('theme_phone_number'); ?>" />
<?php
}
function display_logo_element()
{
?>
<input type="file" name="customtheme_logo" id="customtheme_logo" enctype="multipart/form-data" />
<input type="submit" name="submit" value="Upload File" />
<?php echo get_option('customtheme_logo');
var_dump(get_option('customtheme_logo')); ?>
<?php
}
function display_twitter_element()
{
?>
<input type="text" name="twitter_url" id="twitter_url" value="<?php echo get_option('twitter_url'); ?>" />
<?php
}
function display_facebook_element()
{
?>
<input type="text" name="facebook_url" id="facebook_url" value="<?php echo get_option('facebook_url'); ?>" />
<?php
}
function display_address_element()
{
?>
<input type="text" name="address_info" id="address_info" value="<?php echo get_option('address_info'); ?>" />
<?php
}
function display_fax_element()
{
?>
<input type="text" name="fax_number" id="fax_number" value="<?php echo get_option('fax_number'); ?>" />
<?php
}
function customtheme_theme_settings_page()
{
?>
<div class="wrap">
<h1>Theme Panel</h1>
<form method="post" action="options.php?page=theme_options"> <!-- AM I USING THE WRONG PAGE HERE? -->
<?php
settings_fields("settings_html_fields");
do_settings_sections("theme_options");
submit_button();
?>
</form>
</div>
<?php
}