The appthemes_add_submenu_page action hook is triggered within the WordPress admin theme option pages. This hook provides no parameters but must be used in conjunction with the appthemes_add_submenu_page_content function in order to work properly.



This example creates a brand new option menu item called, “My Menu Name” within the AppThemes option menu. You will need to paste this code within your functions.php theme file.

function my_custom_appthemes_admin_page() {
    add_submenu_page('admin-options.php', 'My Page Title',  'My Menu Name' , 'manage_options', 'my-page-url', 'my_custom_appthemes_admin_page_content');
add_action('appthemes_add_submenu_page', 'my_custom_appthemes_admin_page', 10);

As you can see, this admin hook uses the WordPress function add_submenu_page with the following syntax:

 add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); 

The parameters can all be changed except for the following:


This example puts all the pieces together by using both the appthemes_add_submenu_page and appthemes_add_submenu_page_content functions to create a new admin theme sub-menu, sub-menu page, and saves the options to the WordPress database.

You would need to place this code in your functions.php file.

// hook into the theme menu and create a sub-menu item
function my_custom_appthemes_admin_page() {
    add_submenu_page('admin-options.php', 'My Page Title',  'My Menu Name' , 'manage_options', 'my-page-url', 'my_custom_appthemes_admin_page_content');
add_action('appthemes_add_submenu_page', 'my_custom_appthemes_admin_page', 10);
// create the actual page and new field(s)
function my_custom_appthemes_admin_page_content() { 
    global $app_abbr;
$my_options = array( 
		array(  'type' => 'tab',
			'tabname' => __('Tab Title', 'appthemes')),
		array(	'name' => __('Section Title', 'appthemes'),
			'type' => 'title',
			'desc' => '',
			'id' => ''),
		array(  'name' => __('Option Name','appthemes'),
			'desc' => '',
			'tip' => __('Enter your tooltip text here.','appthemes'),
			'id' => $app_abbr.'_custom_field_name',
			'css' => 'min-width:100px;',
			'std' => 'yes',
			'vis' => '',
			'req' => '',
			'js' => '',
			'min' => '',
			'type' => 'select',
			'options' => array(  'yes' => __('Yes', 'appthemes'),
					     'no'  => __('No', 'appthemes'))),
		array(  'type' => 'tabend'),						 
// update and save the options in the WordPress database on form submit
	<div class="wrap">
        <div class="icon32" id="icon-tools"><br/></div>
        <h2><?php _e('Testing','cp') ?></h2>
        <form method="post" id="mainform" action="">
            <p class="submit btop"><input name="save" type="submit" value="<?php _e('Save changes','appthemes') ?>" /></p>            
	<?php appthemes_admin_fields($options_testing); ?>
            <p class="submit bbot"><input name="save" type="submit" value="<?php _e('Save changes','appthemes') ?>" /></p>
            <input name="submitted" type="hidden" value="yes" />
add_action('appthemes_add_submenu_page_content', 'my_custom_appthemes_admin_page_content', 10);

So what does all that code actually do? It creates a new theme admin sub-menu called “My Menu Name”. When you click on it, you’ll see a new page with one drop-down option called “Option Name”.

If you save the page, you’ll instantly save that admin option in the WordPress options table. Then you can write a function or if statement to execute based on the value.

A simpler test would be to just echo the value by using the WordPress ‘get_option’ function like this:

<?php echo get_option( $app_abbr.'_custom_field_name' ); ?>

Paste that anywhere in your theme index.php template and you should see either a ‘yes’ or ‘no’ printed on your screen. If not, make sure you’ve actually saved a value and that $app_abbr is globally set (i.e. global $app_abbr;).


  • since appthemes-functions.php version 1.2

Source File

appthemes_add_submenu_page() is located in includes/admin/admin-options.php.

Your rating: none
Rating: 3 - 2 votes

Popular Add-ons


A Stunning Child Theme for Classipress 4


Listings by Category or Tag

Display listings by Category or Tag using a filter widget.


Daleel for Vantage

Daleel is a fresh and clean Child theme for Vantage 4.x.