-2

I'm trying to modify the button text on a subscribe widget in WordPress. I'm using Voux theme and would like to change the button text from Go to Ok. Is there a way by which I can modify widgets by modifying the code?

Also, in the same widget, there is a HTML < input > tag for entering data, which has a placeholder 'Your E-mail'. I want to change the existing placeholder text to 'E-mail', can this be done using CSS? I know it can be done via HTML but I don't think I can modify the HTML of a widget.

Any help will be greatly appreciated. Thank you!

Harshwardhan S
  • 61
  • 2
  • 11

2 Answers2

0

Hey there yes indeed there are possibilities without modifying the widget code which is probably not a good idea if it comes from the core or a Plugin.

Modifying text from "Go" to "Ok": Use CSS :after pseudo selector - look here How can I replace text with CSS?

Modify placeholder with CSS - look here: How to set placeholder value using CSS?

Furthermore you can change a placeholders' content with javascript, too. Do some research with Google next time your question is just a mix of duplicates.

Community
  • 1
  • 1
Blackbam
  • 17,496
  • 26
  • 97
  • 150
  • I tried using the CSS :after pseudo selector, didn't help. I don't want to change the color of the placeholder. I want to replace the placeholder text. – Harshwardhan S Sep 20 '16 at 17:13
  • True I looked a bit to fast - you have two possibilities: Either you change the placeholder text with JavaScript or you try to set the placeholder value with CSS and webkit. – Blackbam Sep 20 '16 at 17:34
0

Okay, I had a look at the theme and it's widgets. The widgets are customized to the theme, so I think your question is valid enough, and it seems their support doesn't help with customization questions even if you bought the theme, so here goes:

You can edit the php-file directly in thevoux-wp\inc\widgets\subscribe.php.

Look at line 35:

<div class="small-3 columns"><button type="submit" name="submit" class="btn black"><?php _e("GO",'thevoux'); ?></button></div>

The _e() function is wordpress's way to translate strings, but I'll go the easy route, just remove it:

<div class="small-3 columns"><button type="submit" name="submit" class="btn black">OK</button></div>

Done! Keep in mind this "fix" has the potential to reset to its initial state if you update the theme.

As for the placeholder:

Same file, line 34:

<div class="small-9 columns"><input placeholder="<?php _e("Your E-Mail",'thevoux'); ?>" type="text" name="widget_subscribe" class="widget_subscribe"></div>

I think you can see where this is going...

<div class="small-9 columns"><input placeholder="E-Mail" type="text" name="widget_subscribe" class="widget_subscribe"></div>

And in an attempt to be thorough...

Editing the theme source files is not considered to be very pretty, especially since it can break on theme-updates. I would consider the proper fix to be:

  1. Unregister the widget.
  2. Extend the widget
  3. override the widget-function (Copy the old one, make changes).
  4. Re-register your "sparkling new" widget.

It's not hard if you know your way around Wordpress/PHP, but with the questions you are asking I probably wouldn't bother unless you are in it for the kicks.

ippi
  • 9,857
  • 2
  • 39
  • 50