How to Center and Customize Your OnePress Theme Header Menu
Content
Customizing the header menu is one of the most common tasks for OnePress theme users. Many site builders want to center their logo, align their navigation, or create a unique layout like a logo placed between menu items. This guide compiles the most effective solutions from the community to help you achieve your desired header design.
Why is the OnePress Menu Aligned to the Right by Default?
The OnePress theme uses a traditional header structure where the logo or site title is floated to the left and the primary navigation menu is floated to the right. This is a common web design pattern. The theme's built-in customizer options offer some control, but for more advanced layouts, custom CSS is often required to override these default styles.
Common Solutions for Centering the Menu and Logo
1. Centering the Entire Menu
If your goal is to center the navigation menu horizontally, you can use the following CSS code. Add this to Appearance > Customize > Additional CSS.
.onepress-menu {
float: none !important;
display: table;
margin: 0 auto;
}
2. Centering the Logo Above the Menu
To center your logo on its own line above a centered menu, use this combination of CSS rules.
.site-branding {
width: 100%;
text-align: center;
float: none;
}
.onepress-menu {
float: none;
display: table;
margin: 0 auto;
}
3. Creating a Logo-in-Menu Layout (Advanced)
A frequently requested layout places the logo in the center of the menu, with navigation items on both sides. This requires a more complex CSS approach to rearrange the header elements. The following code is a common starting point suggested by community members.
.site-branding {
float: right !important;
}
.onepress-menu {
float: left;
margin-right: 40px;
}
@media screen and (max-width: 1140px) {
.site-branding {
float: left !important;
}
.onepress-menu {
margin-right: 0px;
}
}
Note: Achieving a perfect logo-in-menu layout often requires significant additional customization and testing across different screen sizes. It may not be achievable with CSS alone and could require modifying theme template files.
Troubleshooting Common Issues
- Extra Space Around the Menu: After centering, you might notice unwanted space. This can often be adjusted by modifying the
marginandpaddingproperties on the.onepress-menuor.main-navigationelements using your browser's inspector tool. - Mobile Responsiveness: Always test your changes on mobile devices. Use
@mediaqueries (as shown in the advanced example above) to ensure your centered menu looks good on all screen sizes. For mobile-specific centering, you might need to target the header wrapper:@media only screen and (max-width: 640px) { .header-right-wrapper { float: none; display: table; margin: 0 auto; } } - Submenu Positioning: If you have centered your menu and find that dropdown submenus are misaligned, check the theme customizer for an option labeled "Center vertical align for menu" and ensure it is unchecked, as this can sometimes interfere with submenu placement.
What Isn't Possible with Standard Customization
Based on community threads, the following header modifications are not supported by the theme's default options and would require creating a child theme and editing PHP template files (like header.php):
- Adding a full-width banner above the logo and menu.
- Adding custom HTML content (e.g., a phone number) to the right side of the menu bar.
- Completely separating the logo and menu into distinct rows without extensive code changes.
For these complex structural changes, it is recommended to seek assistance from a developer familiar with WordPress theme structure.
Conclusion
Centering your OnePress header menu is a straightforward process using the CSS snippets provided. Start with the basic centering code and test your site after each change. For more ambitious layouts, be prepared to experiment with different CSS properties and media queries to achieve a responsive and visually pleasing result.
Related Support Threads Support
-
Add a button to the tophttps://wordpress.org/support/topic/add-a-button-to-the-top/
-
Header with image +logohttps://wordpress.org/support/topic/header-with-image-logo/
-
logohttps://wordpress.org/support/topic/logo-142/
-
Header Menu bisected with logo in center? HELP PLEASEhttps://wordpress.org/support/topic/header-menu-bisected-with-logo-in-center-help-please/
-
Center Logo and Hamburger Menu for Mobilehttps://wordpress.org/support/topic/center-logo-and-hamburger-menu-for-mobile/
-
Horizontal alignment header menuhttps://wordpress.org/support/topic/horizontal-alignment-header-menu/
-
Move Menu down slightlyhttps://wordpress.org/support/topic/move-menu-down-slightly/
-
menu centeredhttps://wordpress.org/support/topic/menu-centered/
-
Site title on two line? How can I do its?https://wordpress.org/support/topic/site-title-on-two-line-how-can-i-do-its/
-
Add 2nd Menu to Footerhttps://wordpress.org/support/topic/add-2nd-menu-to-footer/
-
Hide/swap logo and center menu when scrollinghttps://wordpress.org/support/topic/hideswap-logo-and-center-menu-when-scrolling/
-
How to add section title to menu?https://wordpress.org/support/topic/how-to-add-section-title-to-menu/
-
2 logo’shttps://wordpress.org/support/topic/2-logos/
-
Navigation/menu alignmenthttps://wordpress.org/support/topic/navigationmenu-alignment/
-
How do I fix my header menu?https://wordpress.org/support/topic/how-do-i-fix-my-header-menu/
-
Menu Width = custom css?https://wordpress.org/support/topic/menu-width-custom-css/
-
New Page Without menu and without marginhttps://wordpress.org/support/topic/new-page-without-menu-and-without-margin/
-
Centering nav menu (not mobile)https://wordpress.org/support/topic/centering-nav-menu-not-mobile/
-
Home Page NavBar Center vertical align not workinghttps://wordpress.org/support/topic/home-page-navbar-center-vertical-align-not-working/
-
Position of the Primary Menühttps://wordpress.org/support/topic/position-of-the-primary-menu/
-
Text on the right of the menu in header?https://wordpress.org/support/topic/text-on-the-right-of-the-menu-in-header/
-
Moving the menu and logohttps://wordpress.org/support/topic/moving-the-menu-and-logo/
-
Centered Menu ?https://wordpress.org/support/topic/centered-menu-2/
-
How do I create Menu’s in the header?https://wordpress.org/support/topic/how-do-i-create-menus-in-the-header/
-
Menu and Site Logohttps://wordpress.org/support/topic/menu-and-site-logo-2/
-
Help to align menuhttps://wordpress.org/support/topic/help-to-align-menu/
-
How do I create sub-menu’s in the header nav menu?https://wordpress.org/support/topic/how-do-i-create-sub-menus-in-the-header-nav-menu/
-
How do I add HTML content below Top Menu?https://wordpress.org/support/topic/how-do-i-add-html-content-below-top-menu/
-
How do I slide the header to the right?https://wordpress.org/support/topic/how-do-i-slide-the-header-to-the-right/
-
Desktop menu vertical alignmenthttps://wordpress.org/support/topic/desktop-menu-vertical-alignment/
-
Add text above menu in headerhttps://wordpress.org/support/topic/add-text-above-menu-in-header/
-
Two row menu titlehttps://wordpress.org/support/topic/two-row-menu-title/
-
Centered Logo and Menu (with submenu)https://wordpress.org/support/topic/centered-logo-and-menu-with-submenu/
-
Center Navigation Menu Not Workinghttps://wordpress.org/support/topic/center-navigation-menu-not-working/
-
CSS to make second level menu horizontalhttps://wordpress.org/support/topic/css-to-make-second-level-menu-horizontal/
-
Is it possible to have co logo in middle of top menu navhttps://wordpress.org/support/topic/is-it-possible-to-have-co-logo-in-middle-of-top-menu-nav/
-
customize headerhttps://wordpress.org/support/topic/customize-header-10/
-
Wrap menu around logohttps://wordpress.org/support/topic/wrap-menu-around-logo-2/