Hello I'm currently following a guide on how to add input to my created Sub Menu Pages. Here is a pic of what is showing up. http://imgur.com/a/St9wj .When I view the sub-menu page. No Errors, just not showing the text field. The Function function mytheme_general_name() is not getting called in the 2nd add_submenu_page, but I don't see what is wrong with it.
I copied the Here is my Current two php files in use
File Name: function-admin.php
/*
@package Jeron
========================
ADMIN PAGE
========================
*/
function mytheme_add_theme_options() {
// Generate Theme Options Page
add_menu_page('My Themes Theme Options', 'Theme Options', 'manage_options', 'theme2_options', 'mytheme_create_page', get_template_directory_uri().'/img/themeoptionsicon.png', 110);
// Generate Theme Options Sub Pages
add_submenu_page('theme2_options', 'Theme Options', 'General', 'manage_options', 'theme2_options', 'mytheme_create_page');
add_submenu_page('theme2_options', 'Typography', 'Typography', 'manage_options', 'theme_options_typography', 'mytheme_create_typography_page');
}
add_action('admin_menu', 'mytheme_add_theme_options');
// Activate Custom Settings
add_action('admin_init', 'mytheme_custom_settings');
function mytheme_custom_settings() {
register_setting('mytheme-settings-group', 'first_name');
add_settings_section('mytheme-general-options', 'General Settings', 'mytheme_general_options', 'theme2_options');
add_settings_field('general-name', 'First Name', 'mytheme_general_name', 'theme2_options', 'mytheme_settings_group');
}
function mytheme_general_options() {
echo 'Customize Your Theme Options Below';
}
function mytheme_general_name() {
$firstName = esc_attr(get_option('first_name'));
echo '<input type="text" name="first_name" value="'.$firstName.'" placeholder="First Name" />';
}
function mytheme_create_page() {
require_once(get_template_directory().'/inc/templates/mytheme-admin.php');
}
function mytheme_create_typography_page() {
echo '<h1>My Theme Typography</h1>';
}
?>
File Name: mytheme-admin.php
<h1>My Theme Options</h1>
<?php settings_errors(); ?>
<form method="post" action="options.php">
<?php settings_fields('mytheme_settings_group');?>
<?php do_settings_sections( 'theme2_options' ); ?>
<?php submit_button(); ?>
</form>