WordPress theme developing - wordpress

I need to add submenu to Appearance menu at WordPress like Background, Header, etc. Please, see the screenshot - http://i28.fastpic.ru/big/2012/0322/17/2ea91d7afac4e8a6755cebfef434aa17.png
Anybody know how to do it according to WordPress theme developing standarts?

In your theme functions.php you can add sub menu's by using add_submenu_page
add_submenu_page( 'themes.php', //this is the appearance menu
$page_title,
$menu_title,
$capability,
$menu_slug,
$function
);
Ref: http://codex.wordpress.org/Function_Reference/add_submenu_page

You could create an admin panel plugin.
Or
If you want to add a section to the admin panel directly from your theme, then i think this link provides details that will help guide you (although I'm not sure it covers how to get it into the Appearance menu).

Related

Remove menu item from sidebar

Someone created a menu in wordpress sidebar. I need to remove that permanently. Can anybody say how can we do that? In this image ( the wordpress dashboard image which you going to see when open this link below ) you can see portfolio, careers, team etc. These are the links someone added before and we need to remove. Thanks :)
http://dev.netbramha.in/projects/image/Untitled.pngenter code here
You can remove menu items using action hook.
function remove_dashboard_menus(){
remove_menu_page( 'wpcf7' );
}
add_action( 'admin_menu', 'remove_dashboard_menus' );
remove_menu_page parameter you can pick up from address URL page parameter like this : http://localhost/wpdemo/wp-admin/admin.php?page=wpcf7
If you are using CPT UI plugin, you can open it in your admin and you will find the portolio cpt created there. Just delete from there.
If you are not using CPT UI plugin, you can go to functions.php and remove the code where portfolio code is defined.
In functions.php check add_action() function. You can find these menu items there.

Where do I put Settings API code for my Wordpress Theme

I am trying to set up a settings page for my wordpress theme (developed it in roots.io using Trellis and Sage etc).
I have found a lot of really good documentation on how to use the settings API, for example:
https://wpshout.com/making-an-admin-options-page-with-the-wordpress-settings-api/
or
http://qnimate.com/wordpress-settings-api-a-comprehensive-developers-guide/
and a few others.
So lets say that I want a theme option page, this code should do it:
add_action( 'admin_menu', 'NEW_admin_add_page' );
function NEW_admin_add_page() {
add_options_page(
'Theme settings Page',
'Theme settings',
'manage_options',
'nts',
'nts_options_page'
);
}
Should create a new page, but where within my theme do I add this code to ensure that when you load this theme (or when it loads if that is the right thing) this page turns up.
Found it, just add it to functions.php seems to do the trick :)
Strangely enough it was not until the tenth article I read that someone thought to mention this :)
https://code.tutsplus.com/tutorials/the-wordpress-settings-api-part-2-sections-fields-and-settings--wp-24619

Moving WordPress default menus in admin

I've been digging around the codex trying to find a way to move the default menus around in the admin area. specifically i want to take the customizer from the appearance menu and move it to my custom menu. same with other menus. Is there a list somewhere of for them or a file to edit with the orders or way to move them. I don't want to edit any core files though as obviously will break on any update.
I already have my own menu: image of own menu code is below for mine.
function dcmaintheme_menu() {
add_menu_page( 'dcmaintheme_adminpage', 'Dragon Cove Theme', 'manage_options', 'dcmaintheme_adminpage', 'dcmaintheme_page', content_url( 'themes/dragon-cove-base/img/icon.png' ), 10 );
add_submenu_page( 'dcmaintheme_adminpage', 'Admin Options', 'Admin Options', 'manage_options', 'submenu_adminoptions_page', 'submenu_adminoptions_page' );
what id like to get is another sub-menu that links to say the appearance->customiser and have it in my custom menu.
You can use this plugin, it will allow you to customize the Admin Toolbar and the Admin Side menu. You can choose what content on the menu to display to a specific user role.

How to a add Wordpress Menu Page (in the admin panel) with a custom link?

I want a menu link right under the Settings one in the admin panel with a custom link. (Example: "Go to Google" with a link to google)
I've searched through the codex but couldn't find how can I link it to a custom address. All I could find was this:
<?php add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); ?>
How can I do this?
Thanks!
Only thing i can think off is putting an auto redirect on the admin page.
So when the link is pressed you go to the admin page immediately sents you to the page.
Look at the php header function.

WordPress Custom Theme Favicon in Dashboard Menu

When you create a custom theme in WordPress, you can add a link to your theme options on the left menu in the WP dashboard. The default icon that's used next to your menu label is called generic.png and resides in the wp-admin/images directory.
Anyone know how to tell WP to use my theme's custom favicon.png instead of the default?
I figured this one out. Hopefully it can help others:
add_menu_page('Page title', 'Top-level menu title',
'administrator', 'my-top-level-handle',
'my_magic_function','../wp-content/themes/yourTheme/img/favicon.png');
You can also add a submenu under your theme's main menu item like so...
add_submenu_page( 'my-top-level-handle', 'Page title',
'Sub-menu title', 'administrator', 'my-submenu-handle', 'my_magic_function')
Easiest way is to use ICO format for your Favicon.
If you have other image for and want it to convert in ICO format, you can use ICO Converter to do that!

Resources