Academia WordPress主题头部响应式调整:将菜单折叠阈值改为800px
Got it, let's get that menu breakpoint sorted for your Academia theme. Here are three straightforward methods to switch the collapse threshold from 1200px to 800px—pick the one that fits your comfort level:
Method 1: Use Custom CSS (Easiest & Safest)
This method doesn’t require editing theme core files, so you won’t lose changes when the theme updates.
- Go to your WordPress dashboard → Appearance > Customize > Additional CSS
- Paste this code into the CSS editor:
/* Override menu collapse breakpoint to 800px */ @media (max-width: 800px) { /* Hide desktop menu on screens ≤800px */ .academia-main-menu { display: none !important; } /* Show mobile hamburger toggle */ .academia-mobile-menu-toggle { display: block !important; } } @media (min-width: 801px) { /* Keep desktop menu visible on screens >800px */ .academia-main-menu { display: block !important; } /* Hide mobile toggle on larger screens */ .academia-mobile-menu-toggle { display: none !important; } }
- Click Publish to save changes.
Note: If the class names don’t work (themes sometimes use slightly different classes), right-click your menu/hamburger button and select "Inspect" to find the correct CSS classes for your specific theme version.
Method 2: Edit Theme Files (Use a Child Theme!)
If you prefer modifying the theme’s actual stylesheet, always use a child theme to avoid losing changes during updates:
- Create and activate an Academia child theme if you haven’t already.
- Locate the theme’s responsive CSS file (usually
responsive.cssinside the theme’scssfolder, or media queries instyle.css). - Search for all instances of
@media (max-width: 1200px)that control menu visibility. - Replace
1200pxwith800pxin those media queries. - Save the file and upload it to your child theme’s corresponding folder.
Method 3: Check Theme Customizer Options (Quick Win)
Some themes include built-in settings for responsive breakpoints. Before diving into code, check:
- Go to Appearance > Customize
- Look for sections like Header Settings, Responsive Settings, or Menu Settings
- See if there’s an option labeled "Menu Collapse Breakpoint" or similar—if so, just input
800pxand save.
Troubleshooting Tip
If the custom CSS doesn’t take effect, it might be due to CSS specificity. Try adding a parent class to your selectors (e.g., .site-header .academia-main-menu) instead of just the menu class, or keep the !important flag to override existing styles.
内容的提问来源于stack exchange,提问作者Akshay

