开发者

How do I change the template of the Mailchimp Wordpress widget?

开发者 https://www.devze.com 2023-02-25 08:48 出处:网络
I want to change how the form looks like and the labels on the field开发者_StackOverflow中文版s of the form.Login in as Admin and then, under the Plugins area in the sidebar, click Editor. There\'s a

I want to change how the form looks like and the labels on the field开发者_StackOverflow中文版s of the form.


Login in as Admin and then, under the Plugins area in the sidebar, click Editor. There's a dropdown menu labeled "Select plugin to edit". Click that and select "MailChimp" and then click the "Select" button. The sidebar widget form is called mailchimp/mailchimp_widget.php

The form's code begins right after the first PHP block.

You can also edit the code directly by looking in the wordpress/wp-content/plugins/mailchimp/ directory. The translations are in the po sub-directory.

The trick with this template is that the fields are loaded from elsewhere. In order to change the label, you have to set the option of the fields in the PHP code. Each field is looped through and printed out automatically.

For example to change the "Email Address" label to read "Email" add the following code at the end of the first PHP block:

$mv[0]['name'] = 'Email';

This assumes that the first field that will be printed out is the Email Address field. You can do a var_dump to see what other options are available.

If you want to make more drastic changes to the form, remember that when the widget is updated, you'll have to make the changes again and merge them with the updated version.

0

精彩评论

暂无评论...
验证码 换一张
取 消