0

So I'm wanting to add a couple of buttons in a footer text widget. It should be a really easy task by just creating a class inside of a link, and then styling it with CSS, like this:

<a href="/newsletter" class="news-button">Newsletter</a>

a.news-button { width: 150px; height: 40px; border: 2px solid #000; border-radius: 3px; display: block; text-decoration: none; text-align: center; padding: 10px 0 0 0; font-size: 24px; color: #000; }

Normally, this would work fine, like in this JS Fiddle: https://jsfiddle.net/b9mc74p1/

However in my WordPress widget, .et_pb_widget a is overriding everything else. And if I tried to just apply CSS to .et_pb_widget a, it's going to add it to all my widget links, which I do not want.

I even tried adding !important (I know, that's bad practice) but it still didn't work. I'd rather avoid a plugin for something this simple. Any ideas?

Link: http://mygirlfriends.kitemedia.com/ (footer, bottom right widget)

  • If the widget doesn't have any hooks/filters then you might be able to do it by modifying the whole output instead. See-> philipnewcomer.net/2014/06/filter-output-wordpress-widget If you have access to change your theme, I would consider using wp_nav_menu instead, and create a footer menu under Appearances -> Menus. – gdaniel Aug 2 '17 at 18:28
  • Why would the !important have not worked? If that didn't work, there's probably some problem that will be hard to overcome. Can you provide a link? – JakeParis Aug 2 '17 at 19:14
  • Sure, it's mygirlfriends.kitemedia.com. In the footer, bottom right widget. – Coltvant Aug 2 '17 at 19:16
0

why not tie them all together?

.et_pb_widget a.news-button {
    color: green;  //example color.
    text-decoration: none;
}
  • That seems like it would work, but it's giving me the same issue. – Coltvant Aug 2 '17 at 19:20
  • just tried it with debugger and it worked fine...did you put that in the style.css? – rudtek Aug 2 '17 at 19:21
  • I'm sorry to waste your time...I had an extra bracket in my stylesheet. You're right, it did work. I'll close this thread. Thanks for the help! – Coltvant Aug 2 '17 at 19:23
  • No worries. It happens. Can you mark it as answered? – rudtek Aug 2 '17 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.