The WordPress Menu Manager found on the Dashboard under “Appearance” >> “Menus” can be used to create custom menus that can be used with widgets, see Custom Menu Widget Tutorial and for creating custom navigation menus many WordPress Themes use. You can check if your WordPress theme includes support for custom WordPress navigation menus under “Appearance” >> “Menus” : “Manage Locations”. Most newer WordPress themes include support for WP Nav menu theme locations to replace the older style automated WordPress navigation menu: older themes would add all Static Pages to the navigation menu with limited options for customization. WordPress Theme Custom Navigation Menus Stallion Responsive for example includes four WordPress Navigation Menus Primary Navigation Secondary Navigation Footer Links Photo Navigation […]
Continue Reading WordPress Navigation Menu
WP Menu CSS Changed?
Has there been a change in something that the would cause my custom CSS menu design to change from 8.0 to 8.1?
Here is a site still on 8.0 polishgrammar.com
While here is a site on 8.1
political-economy.com The CSS is the same. I will try to figure this out, it is something simple I am sure. But if you have hint let me know.
Customize WordPress Theme CSS File
Hi Mark,
Yes the Stallion Responsive 8.1 menu CSS and corresponding HTML code has been changed a LOT to remove the need for Jquery and other javascript to generate the mobile version of the menu, means a major performance improvement as Stallion Responsive no longer needs any javascript by default.
Means if you’ve made a custom CSS file manually would probably be easier to start from the new default colour CSS file from 8.1 and recreate whatever CSS changes you made to create your custom file again.
Since I was making menu changes I changed the main menu CSS class from menu to srumenu to avoid any clashes with plugins in the future, menu as a CSS class was too general and ran the risk if a plugin used menu as a class to mess things up.
I also changed the photo navigation menu as well which is why it’s not working with your custom CSS file. With that menu removed the need for multiple javascript files, replaced the accordion javascript code with CSS code, so you’ll need the new code from the 8.1 CSS file.
Had to do this sort of update myself in the past, I find it helps to add comments to the modified files as I make the changes so it’s easy to add them to the next update, otherwise it’s a lot of hassle trying to remember what changes you made.
something like
Makes it a lot easier for copying and pasting when making updates with major customizations.
You might find it easier with this sort of major CSS code changes to add your code changes to the bottom of the CSS file you are working with (a copy in the child theme folder) or even added to the top of the mobile.css file (again copied to the child theme folder) since it’s enqueued last.
When CSS is read by a browser it’s the last rule that’s used, so if you add the same CSS code twice with changes the last version will be used, the first will be ignored.
For example at the top of the Dazzling Blue and Cayenne Theme CSS file
If you added the same code to the bottom of the Dazzling Blue and Cayenne Theme CSS file or top of mobile.css with a different color code like:
Only the last version of background-color: would be used.
Means you can copy sections of CSS code you want to change, modify it in one block making it much easier to copy to a new file during an update.
This doesn’t work with everything, you have to be able to replicate the CSS completely and change it (or add to it), so works with the CSS example above. However if you wanted to change say
to
You would still have the “margin-bottom: 10px;” from the first CSS rule group, so where you would just delete the line “margin-bottom: 10px;” if you didn’t want the 10px bottom margin, with the copy and change approach you still have to set margin-bottom to something to not have it set to 10px, there has to be a second copy of margin-bottom that replaces the first instance. You might use:
This would remove the bottom margin (set to 0) and add a top margin and the font and clear would be used from the original CSS rules.
This is actually how the mobile.css file CSS rules work, you’ll find what’s in mobile.css is copied from either the layout CSS file or the color CSS file and set to only be used when the screen width is a particular size.
You’ll find in the mobile.css file there’s 11 versions of
Where XXX is unique to each instance, each one takes priority at a specific device width.
If you can write your CSS code so it can be added to the current CSS rather than deleting/replacing CSS code will make your updates far easier. For the most part will be copy and paste from old to new with modifications to take into account anything changed between updates like the class .menu changing to .srumenu.
David
Customize WordPress Theme CSS File
Fixed WP Navigation Issue and Moved to Child Theme
I found where the issue was. I ended up changing the class of the menu from strmenu to menu and it worked.
I used the files editor from Worpress Dashboard to modify the file “navigation-menu.php”.
Then I use FTP to move this to the child theme.
Thanks for your reply.
Responsive menu not working
Hi Dave I noticed that on my sites like political-economy.com the normal menu works and is fixed but the nice responsive menu you created does not. Do you know know a quick fix for this? Thanks, Mark
Cusomizing WordPress Themes
Since you’ve used the older Stallion Responsive code no quick fix.
The new HTML and CSS code for Stallion Responsive 8.1 is significantly better than the 8.0 code from a performance perspective.
You’ve lost your mobile menu because I stripped out the need for javascript to create the mobile menu, but you’ve added the HTML part of the code back in, but not the javascript (some jquery scripts). I removed quiet a bit of PHP code from Stallion to remove the javascript it no longer uses.
So you’ve added half a feature with poor performance metrics back in to add a little bit of CSS styling which I guess could be added to the 8.1 CSS code.
You’d have been much better off starting with Stallion Responsive 8.1 CSS code (shouldn’t need to touch the php template files) and adding CSS code you wanted (the hoverover colour stuff) to the end of the mobile.css file or the end of the colour css file.
BTW Nice hoverover menu colour feature.
David
Cusomizing WordPress Themes
Customizing Secondary Menu Appearance
Hi Dave,
I really like the idea of the secondary menu and planning to incorporate one to encourage deeper engagement. I’m just using the primary menu right now which has 6 choices for users. My menu choices lead to pages which in most cases have quite low exit % which is what I’m going for.
I’d like to use the secondary menu to a) offer more choices to promote more engagement, as the current menu is getting a bit full and b) move one or two of my current menu items to a slightly less-prominent position.
My question is, is there a way to adjust the css styling for only the secondary menu? I’d basically like to make the text itself smaller, and secondary menu bar thinner than the primary menu, to reflect the relative importance of choices on each of the menus, which is how I often see it done on sites with two menus. Basically making the secondary menu less prominent, and also I like the aesthetic of a more understated secondary menu.
Based on what I’ve tried to change it seems to me that the CSS styling controls both menus’ appearances. Is there a way to separate this out somehow so I can just adjust the appearance of the secondary menu? I checked in the CSS inline editor and unless I’ve missed it didn’t see a way to only adjust the secondary menu’s appearance.
Thanks,
Erik
Customizing Secondary Menu Appearance
Secondary WP Nav Menu Customization
To keep the CSS used to a minimum the two menus share the same rules.
If you wanted the secondary navigation menu to use a different rule set you’d need to create a second rule set.
There’s CSS classes specific to the two different ways to use the secondary nav menu:
.header_nav_box_top – For when the secondary WP nav menu isn’t fixed at the top and
.header_nav_box_top_fix – For when the secondary WP nav menu is fixed.
Depending on which version of the secondary menu you use (fixed or not) determines which of the two you’d use. I’ll use fixed for the example.
Find the general CSS rules you want to change for the secondary nav menu and make a copy. Within the colour CSS file you are using are a set of CSS rules starting .srumenu these are the menu CSS rules.
Below is one of the CSS rules.
Simply making a copy of a rule and adding the .header_nav_box_top_fix to the rule will mean it only works for the fixed version of the secondary menu.
By using “.header_nav_box_top_fix .srumenu” it means that CSS rule will look for an element using the .srmenu class that’s also within an element with the .header_nav_box_top_fix class.
So the original CSS rule is general, acts on all instances of .srumenu and the modified version only acts on the .srumenu that’s also within an element with class .header_nav_box_top_fix.
You could either make a partial copy and modify the rules you want to change or make an entire copy of all the CSS rules related to the menu.
If all you wanted was smaller text for example, but the same colours you only need to copy and modify the bit of the rule related to font size:
The above would have the secondary nav menu the same as the other menu, except the font size is smaller.
David
Secondary WP Nav Menu Customization