0

I installed this Simplenews module, and it gives default field to enter your email to subscribe for newsletter and the fields title is just 'Email:' and I need to change it to something else.

It looks like it's hardcoded and I could just dig through modules files and edit, but I know this is not recommended.

I was hoping maybe I could just paste in some preprocess function to theme's template.php file and replace 'Email:' with e.g. 'Join Our Mailing List:'.

Path to label is form.simplenews-subscribe div div label.

1

Solved!

Put this code to your theme's template.php, where's THEME replace it with your theme's dir name. So then where's #title = t() you put in your own custom title for the field. So what it does it alters given forms field, in this case it's simplenews_block_form inlcuded in between THEME_form_simplenews_block_form_alter

function THEME_form_simplenews_block_form_alter(&$form, &$form_state) {
  $form['mail']['#title'] = t('Join Our Mailing List:');
}

Clear cache!

|improve this answer|||||
  • I added some explanations. – Optimus Prime May 28 '14 at 7:52

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.