need help creating theme options
ive been creating wordpress themes for a little bit now (mainly css)
i have now created my own theme code (custom widget area, dynamic classes for titles, post page titles h1 instead of h2)
this works great so far (no styling, working on the backend for now)
i want to have some theme options for the theme, theres lots of tutorials i know, but im still struggling.
rather than having a "theme options" page, i wanted to have my own top level dashboard item and seperate the theme options into sub pages.
i found a tutorial to do this and it work great. heres the code.
<?php
// this is where you add menu items
// Hook for adding admin menus
add_action('admin_menu', 'mt_add_pages');
// action function for above hook
function mt_add_pages() {
// Add a new top-level menu (ill-advised):
add_menu_page('Architect settings', 'Architect settings', 'administrator', 'as_main_page', 'settings_page');
// Add a submenu to the custom top-level menu: styles
add_submenu_page('as_main_page', 'Design and Layout', 'Design and Layout', 'administrator', 'sub-page', 'design_layout_page');
// Add a second submenu to the custom top-level menu: Social Info
add_submenu_page('as_main_page', 'Social Info', 'Social Info', 'administrator', 'sub-page2', 'social_info_page');
// Add a third submenu to the custom top-level menu: About me
add_submenu_page('as_main_page', 'About Me', 'About Me', 'administrator', 'sub-page3', 'about_me_page');
// Add a forth submenu to the custom top-level menu: Ad Spaces
add_submenu_page('as_main_page', 'Ad Spaces', 'Ad Spaces', 'administrator', 'sub-page4', 'ad_spaces_page');
}
// settings_page() displays the page content for the custom Test Toplevel menu
function settings_page() {
echo "<h2>Architect Settings</h2>";
echo '<div class="wrap">';
echo '<p>"put stuff here"</p>';
echo '</div>';
}
// design_layout_page() displays the page content for the first submenu
// of the custom Test Toplevel menu
function design_layout_page() {
echo "<h2>Styles</h2>";
echo '<div class="wrap">';
echo '<p>"put stuff here"</p>';
echo '</div>';
}
// social_info_page() displays the page content for the second submenu
// of the custom Test Toplevel menu
function social_info_page() {
echo "<h2>Social Info</h2>";
echo '<div class="wrap">';
echo '<p>"put stuff here"</p>';
echo '</div>';
}
// about_me_page() displays the page content for the second submenu
// of the custom Test Toplevel menu
function about_me_page() {
echo "<h2>About Me</h2>";
echo '<div class="wrap">';
echo '<p>"put stuff here"</p>';
echo '</div>';
}
// ad_spaces_page() displays the page content for the second submenu
// of the custom Test Toplevel menu
function ad_spaces_page() {
echo "<h2>Ad Spaces</h2>";
echo '<div class="wrap">';
echo '<p>"put stuff here"</p>';
echo '</div>';
}
?>
this makes the pages fine, but i dont know how to add multiple options to each page? i found a way to add one option per page, but thats no good.
i heard about using arrays, but again i learn by copy and paste rather than reading and every way i try doesnt seem to work.
each page has 1 function, can i make that function create other functions? i think i could get it to work that way.
can someone help me?
Creative Web Development and Design, NOT A FIXED PRICE SERVICE, if you want the best don't settle for an off the shelf solution.
We provide cutting edge design, web development with WordPress, WHMCS, PHP, HTML, CSS, jQuery, and personalised hosting solutions to suit any needs.