WordPress Custom Theme Favicon in Dashboard Menu - wordpress

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!

Related

Customizing my account page in woocommerce wordpress

When I customize the my account page in woocommerce, I can edit right side section by creating my_account.php inside my account folder in woocommerce. But In left side it is showing "Define your 'My Account' navigation Apperance > Menus",
After seeing this I tried to create menu called "My account", but there was no theme location existing, so I create a theme location called "my account menu". And I assign "my account" menu with theme location "my account menu".
I don't know how to connect this menu to my account page in woocommerce, the page again showing same "Define your 'My Account' navigation Apperance > Menus".
Try Appearance>Menus>Custom Links
Otherwise:
Is the theme you are trying to edit a pre-built theme?
Is the platform up-to-date or outdated (sometimes updates/bugs can alter functionality of pre existing code)?
Sometimes there are errors in the theme build, as I have seen. In such a case, I would recommend reaching out to the theme developer(s) as they can usually help the best in this situation. If not, check back. Hope this helps.
Call menu by menu name instead of theme_location
<?php wp_nav_menu( array( 'menu' => 'Main Menu' ) ); ?>

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.

Wordpress - Different sidebar for each page

Client needs an website to migrate into WordPress.
In this website each page has an sidebar with different content inside it
In some page accordion comes under sidebar, in some just text and images are visible
How to implement this in WordPress?
If template has to be created, there are many page it cant be done so
Even for every page different sidebar widget is not also possible
Guide me a way to implement this
A different sidebar (widget) are can be added to each page in two steps:
Add the sidebar to the theme template using the page slug as part of the sidebar name. This ensures that the sidebar has a unique name for that page.
Register the sidebars for each page in functions.php for your theme
Add the sidebar to the theme template
In your theme template, add the following code where you want the widget area to be:
<?php
global $post;
dynamic_sidebar( 'widget_area_for_page_'.$post->post_name );
?>
Register the sidebars
In functions.php for your theme add the following block of code to register the sidebars for each page in your site. Note that it includes draft pages etc so that you can edit the widgets while still in draft mode.
function myTheme_registerWidgetAreas() {
// Grab all pages except trashed
$pages = new WP_Query(Array(
'post_type' => 'page',
'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit'),
'posts_per_page'=>-1
));
// Step through each page
while ( $pages->have_posts() ) {
$pages->the_post();
// Ignore pages with no slug
if ($pages->post->post_name == '') continue;
// Register the sidebar for the page. Note that the id has
// to match the name given in the theme template
register_sidebar( array(
'name' => $pages->post->post_name,
'id' => 'widget_area_for_page_'.$pages->post->post_name,
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
}
}
add_action( 'widgets_init', 'myTheme_registerWidgetAreas' );
Hope it helps!
There's a great plugin for this:
https://wordpress.org/plugins/custom-sidebars/
Sometimes it is necessary to show different elements on the sidebars
for some posts or pages. The themes nowadays give you some areas to
put the widgets, but those areas are common for all the posts that are
using the same template. NOTE: You need to use a theme that accepts
widgets to make this plugin work.
I think this is what you're looking for.
This can be done with the https://wordpress.org/plugins/jetpack/ plugin. Once activated you can choose what widgets display on what pages:
The Widget Visibility module enables you to configure widgets to appear only on certain pages (or be hidden on certain pages) by using the Visibility panel.
Visibility is controlled by five aspects: page type, category, tag, date, and author. For example, if you wanted the Archives widget to only appear on category archives and error pages, choose “Show” from the first dropdown and then add two rules: “Page is 404 Error Page” and “Category is All Category Pages.”
Just tried custom-sidebars with the latest version of wp. Had a hard time deleting it. Database is still messy. Plugin did not work. Maybe the 'pro' version is useful, but the 'non-pro' version would not add a sidebar to the page. It was clunky and did not allow per-page sidebars. It says its not been tested with the latest wp, maybe that's the problem.
You can create custom sidebar for for each post and pages with the help of plugin. There are a few plugins which enables you to create your custom sidebar. Here in this tutorial we are using Easy Custom Sidebars. Download and install this plugin in your website and activate it.
After successfully activating the plugin go to Appearance > Sidebar Replacement
From this page give a name to your custom sidebar and click on the Create Sidebar button. After that go to the Sidebar Properties option. Here you need to select the properties where you want to replace your created custom sidebar instead of theme sidebar. You can view your available option in the drop-down menu. Select it and provide a description on the Sidebar Description field.
Now in the last step select the post or pages to add this custom sidebar. You can see all the option in the left column. You can select specific post, page, category , tag, author to add this sidebar. Just select it and click Add to sidebar option.
For better understanding you can follow this tutorial

WordPress: How to make the 'Theme Options Page' appear on the 'Edit Page'?

Just in case, here's what Theme Options Pages are in WordPress:
http://css.dzone.com/articles/how-create-theme-options-page
I've been racking my brain trying to figure out how to get the Theme Options Page of any WordPress theme to appear on the 'Edit Page' of WordPress. Does anyone know how to do this so each page I create would have different results when published?
I think your problem here is that really WordPress is setup to have a single theme with a single set of options, what your trying to do is essentially have a new theme for each page.
Instead, you probably need individual Page Templates for those options that you would like to customize on a page by page basis (e.g. Blue Background, White Background, Large Logo etc).
If you'd like to have a series of options that are easy to adjust on the fly, you could set up some Custom Fields and then adjust your template to pull settings from them as needed.
First, define action like this:
function mytheme_customize_register( $wp_customize ) {
}
add_action( 'customize_register', 'mytheme_customize_register' );

WordPress theme developing

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).

Resources