Adding sub menu our word press theme to word press admin panel
We have already learned that how to add all available menu ,sub menu to word press plug in.
Now we learn how to add our themes option menu to word press admin panel.
You must aware some knowledge on developing word press theme.
- Word press template tags.
- word press theme file structure.
- Little bit php concepts.
From above specifications word press template comes with main file “functions.php“, that synchronize word press core and template.And add below code to that file.
add_action( 'admin_menu', 'myThemeMenu' ); function myThemeMenu(){ //global theme name stored in this variable global $ThemeName; //add this menu to our theme edit page add_theme_page( $ThemeName . ' Theme Options', $ThemeName . ' Options', 'edit_themes', basename(__FILE__), 'myThemePage' ); } //wat ever you want to change the theme settings here. //this function was called when user clicks on the //theme edit link on appearence admin panel function myThemePage { echo '<h1>My Theme Options Page ,we can add any options to change our theme settings.</h1>'; }
Above code comments tells the concept of each line . Now you can see the options on appearance admin panel.
Fore example your theme name is My-theme,then you see My-theme options link on the appearance admin panel.
Popularity: 3% [?]









Related Articles
No user responded in this post
Leave A Reply