Category: WordPress
(Even If You’re Using an Older Theme or a Custom Link)
We’ve all seen menus where one item just pops — maybe it’s “Sign Up,” “Contact Us,” or “Get Started.” That’s not magic; it’s just smart CSS targeting. In this article, I’ll walk you through how to make a specific WordPress menu item stand out, even if you’re working with a legacy theme or a menu you can’t easily edit in the backend.
Why This Matters
Menus are prime real estate. A single button-like menu item can guide visitors toward your most important action — whether that’s signing up, booking a call, or logging into a client portal.
If you bury that link alongside everything else, it’s easy for people to skip over it. By making it visually distinct, you’re giving visitors a gentle nudge in the right direction.
Use Cases
Here are a few examples where targeting a menu item with CSS makes sense:
- Login/Sign Up for members, students, or customers.
- Book a Call for service businesses.
- Donate Now for non-profits.
- Special Offer or Seasonal Sale links.
- Join the Waitlist for a new product launch.
Step 1: Inspect Your Menu
First, we need to know what to target.
Right-click the menu link in your browser and select Inspect (in Chrome) or Inspect Element (in Firefox). You’ll see something like this:
<li id="menu-item-1317" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1317">
<div class="wrap">
<a href="https://app.example.com" target="_blank">Sign Up / Login</a>
</div>
</li>
From here you’ve got two main options:
- Target by ID – In this case
#menu-item-1317
. - Target by URL – In this case any link containing
app.example.com
.
Step 2: Three Ways to Target the Link
1. Target by Menu Item ID (Most Specific)
#menu-item-1317 > .wrap > a {
background-color: #1565c0;
color: #fff;
padding: 6px 14px;
border-radius: 4px;
font-weight: 600;
}
Pros: Precise, only affects that one item.
Cons: If you delete/re-add the menu item, WordPress will give it a new ID.
2. Target by URL (Flexible)
a[href*="app.example.com"] {
background-color: #1565c0;
color: #fff;
padding: 6px 14px;
border-radius: 4px;
font-weight: 600;
}
Pros: Works even if the menu item ID changes.
Cons: Might affect the same link elsewhere on your site.
3. Scope to the Main Menu + URL (Balanced Option)
#nv-primary-navigation-main a[href*="app.example.com"] {
background-color: #1565c0;
color: #fff;
padding: 6px 14px;
border-radius: 4px;
font-weight: 600;
}
Pros: Flexible, but only inside the main menu.
Cons: Requires knowing your menu’s container ID or class.
Step 3: Make It Look Like a Button
You can keep it subtle or make it really pop. Here’s an example using a slightly darker blue to match a blue-themed site:
#nv-primary-navigation-main a[href*="app.example.com"] {
display: inline-block;
background-color: #1565c0;
color: #fff;
padding: 6px 14px;
border-radius: 4px;
font-weight: 600;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
#nv-primary-navigation-main a[href*="app.example.com"]:hover {
background-color: #0d47a1;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
text-decoration: none;
}
Step 4: Bonus — Let AI Help
If you’re not sure what selector to use, you can copy your menu’s HTML and paste it into your favorite AI tool (yes, ChatGPT works great here).
Just say:
“Here’s my WordPress menu HTML. Write a CSS selector that targets only the link to
app.example.com
in the primary menu.”
You’ll get back a ready-to-use snippet tailored to your code.
Step 5: Where to Put the CSS
The easiest way:
- Go to Appearance → Customize → Additional CSS in your WordPress dashboard.
- Paste your CSS snippet there.
- Publish changes.
For developers, adding it to a child theme’s stylesheet or a custom plugin is more future-proof.
Best Practices & Pitfalls
- Don’t use global selectors like
a[href*="example.com"]
without scoping — you’ll style links all over your site. - Check the mobile menu — some themes use different markup for mobile. You may need a separate selector.
- Test hover and focus states for accessibility.
Final Thought:
Whether it’s a signup button, a “Donate Now” link, or a special promo, making one menu item stand out is an easy win for guiding users. The trick is picking a targeting method that’s specific enough to be reliable, but flexible enough to survive menu changes.