K. Kilian Lindberg
K. Kilian Lindberg

Reputation: 2976

Create a top level menu in wordpress admin for a child theme

I am creating a dedicated theme for an app with some custom settings that will be used just a few times to set up the app from a fresh wordpress install.

How do I create a top level menu in wordpress admin for a twenty twelve child theme via functions.php and a page to contain the settings? I would like to have it as the first item in the menu.

Upvotes: 0

Views: 624

Answers (1)

K. Kilian Lindberg
K. Kilian Lindberg

Reputation: 2976

Here's a solution. Just put this code in the functions.php

<?php
/******* New menu item for admin *********/
add_action( 'admin_menu', 'register_my_custom_menu_page' );

function register_my_custom_menu_page(){
    add_menu_page( 'custom menu title', '♥Custom theme options♥', 'manage_options', 'custompage', 'my_custom_menu_page', '' /* or something like ... plugins_url( 'myplugin/images/icon.png' )*/, 1 ); 
}

function my_custom_menu_page(){
?>
Hello world. This is a simple example page. 
<?php
}

?>

Upvotes: 1

Related Questions