Display Submenu Only On Parent Page

The in-built WordPress menu system allows the content author to create a menu by a simple drag n drop interface, it allows you to select existing posts, page or let you create custom links to add to the menu. Using the drag n drop interface you can select child elements on the menu. When you output the menu on your theme using the function wp_nav_menu() WordPress will automatically create the

Read more...

WordPress Menu Item Icons

In WordPress 3.8 the core had a change to all icons, they now use Dashicons which are fonts that mean you can display an icon by simply adding a CSS class. This can change a few things in the admin area of your application, for example when adding menus to the admin area you might need to change the icon to use a CSS class. If you have created any

Read more...

Style A Specific WordPress Menu Item

The following code snippet will allow you to style a specific menu item differently to the other items. When WordPress creates a menu it will use the menus setup in the WordPress admin, this interface gives the user full flexibility of the what items go in the menu and where they are positioned in the theme. WordPress will automatically add ID's and Classes to these menus so that you can

Read more...

Programmatically Add Menu Item

WordPress comes with a default menu system which gives full control to the admin user of the site to change or create as many menu items as you want. To access the menu system in the admin area you just need to go to Appearance -> Menu. From this screen you will be able to see all the menus that currently exist on your WordPress site, you can select any

Read more...

Display Menus When Location Is Assigned

In WordPress the user can create their own menus in the CMS area by just going to Appearance -> Menus. From this page you can then assign these menus to locations in the theme by choosing the theme location for the menu. These theme locations are setup by the theme developer and is done by using the function register_nav_menus(); The register nav menu function can be placed in the functions.php

Read more...

Disable Changing The WordPress Theme

The problem with having a multi-author blog is that you have a lot of users which have access to the admin area of your WordPress site. When they have access to your admin site they have access to change everything about your blog. Yes you can use your access roles and set the different capabilities, but what if you have multiple admin users but you only want the super admin

Read more...

Add New Menu Items To WordPress Admin

If you are a plugin or theme developer then you will get to the stage where you need to add a link to your plugin or theme settings page in your WordPress admin area. The settings page will allow you your user to customise the plugin or theme in anyway they want. There are different ways you can add links to your plugin or theme settings page. Some people like

Read more...

WordPress Theme CSS Starter

Creating a WordPress theme can be lots of work, but the basic HTML for themes are normally quite similar. Each theme will have a way of looping through a list of posts to show the most recent posts, or to display all the posts in a category. The HTML to display a single post inside the single.php will mainly be the same on any theme you have the header for

Read more...

Add Search Form To A WordPress Menu

Wordpress comes with the functionality to create menus in the dashboard area, from here you can select pages or custom custom menu items to make up your menu. Menus are normally going to be display at the top of the page to give the visitor easy access to your main pages. But this top navigation bar is also a good place to have your search box so if people can't

Read more...

How To Register Menus In WordPress

In a previous snippet we learnt How To Register A Sidebar In WordPress in this snippet we are going to learn how we can easily create custom menus and add them anywhere on your WordPress blog. Create A New WordPress Menu WordPress allows you to create your own custom menus from pages or category items. Using your theme settings you can define where certain menus can appear. For example you

Read more...

1 2