Prerequisites for this WordPress tutorial
For this tutorial, we’ll make the following assumptions:
- We already have a working instance of WordPress (version 3.x)
- Our phpList site is accessible through HTTP / HTTPS from our WordPress site
Installing and configuring the phpList Integration plugin
Download the latest version of Jesse Heap’s phpList Integration plugin from http://wordpress.org/extend/plugins/phplist-form-integration/, unpack it, and upload the contents to your wp-content/plugins/ directory in WordPress.
Activate the plugin from within your WordPress dashboard:
Under the Settings menu, click on the new PHPlist link to configure the plugin:
Under the General Settings heading, enter the URL to your phpList installation, as well as an admin username/password combination. Enter the ID and name of at least one list that you want to allow your WordPress users to subscribe to:
Why does the plugin require my admin login and password?
The admin login and password are used to bypass the confirmation e-mail that would normally be sent to a subscriber. Effectively, the plugin “logs into” phpList as the administrator and then subscribes the user, bypassing confirmation.
If you don’t want to bypass confirmation e-mails, then you don’t need to enter your username and password.
The plugin will work with this section unmodified. However, let’s imagine that we also want to capture the subscriber’s name. We already have an attribute in phpList called first name, so change the first field label to First Name and the Text Field ID to first name (the same as our phpList attribute name):
Adding a phpList Integration page
The plugin will replace the HTML comment <!–phplist form–> with the generated phpList form.
Let’s say we wanted our phpList form to show up at http://ourblog.com/signup.
Create a new WordPress page called Signup, add the content you want to be displayed, and then click on the HTML tab to edit the HTML source:
You will see the HTML source of your page displayed. Insert the text “<!–phplist form–>” where you want the form to be displayed and save the page:
The “<!–some text–>” syntax designates an HTML comment, which is not displayed when the HTML is processed by the browser / viewer. This means that you won’t see your comment when you view your page in Visual mode.
Once the page has been updated, click on the View page link to display the page in WordPress:
The subscribe form will be inserted in the page at the location where you added the comment:
Adding a phpList Integration widget
Instead of a dedicated page to sign up new subscribers, you may want to use a sidebar widget instead, so that the subscription options can show up on multiple pages on your WordPress site.
To add the phpList integration widget, go to your WordPress site’s Appearance option and go to the Widgets page:
Drag the PHPList Integration widget to your preferred widget location. (These vary depending on your theme):
You can change the Title of the widget before you click on Close to finish:
Now that you’ve added the PHPList Integration widget to the widget area, your sign up form will be displayed on all WordPress pages, which include that widget area: