EvanHerman / yikes-inc-easy-mailchimp-extender

Easy Forms for MailChimp WordPress Plugin
http://yikesplugins.com
GNU General Public License v2.0
25 stars 28 forks source link
hacktoberfest mailchimp-api wordpress-plugin

Build Status Scrutinizer Code Quality Code Coverage Build Status

Easy Forms for Mailchimp

[WordPress]() Rating License WordPress plugin WordPress

Latest Stable Beta Release Candidate

This is the development repo for the Easy Forms for Mailchimp plugin by YIKES, Inc. where we work on new features and bug fixes.

Minimum Requirements

Plugin Preview Screenshots

Cloudup Gallery

Documentation

For full documentation, please visit our Knowledge Base.

Integrations

Easy Forms for Mailchimp integrates well with many popular third party plugins for WordPress:

Questions?

Have any questions? Feel free to open up an issue in the issue tracker and we'll get back to you as soon as possible.


Grunt.js

To develop with Grunt place Gruntfile.js file inside the plugin root during development (/wp-content/yikes-inc-easy-mailchimp-extender/). The paths inside Gruntfile.js are setup relative to the plugin root, so placing it anywhere else without changing the paths will cause an error.

First, make sure you install the latest version of Grunt to the local project directory.

$ npm install -g grunt -cli
$ npm install -g grunt

Finally, run the install task to install the required dependencies.

$ npm install
Shortcode

[yikes-mailchimp form="#"]

Full List of Shortcode Parameters
API Key Constant

Example: define( 'YIKES_MC_API_KEY', '12345679-us2' );

CSS Ready Classes
2 Column Layout
3 Column Layout
2/3/4 Colum Radio Buttons
Filters + Hooks
Filters
Hooks
Hooks for Extensions
Helper Shortcodes

Display current number of subscribers [yikes-mailchimp-subscriber-count form="1"]

Display the current number of subscribers for a given list. Pass in the form ID whos list you want to display. (also accepts list="mailchimp_list_id")

If you want to use the snippet inside of your form description, you can exclude the form ID and list ID altogether, and the shortcode will reference the list associated with the displayed form.

Example Form Description: Join the [yikes-mailchimp-subscriber-count] happy subscribers who receive our mailing list!

which might display on the front end like: Join the 1,543 happy subscribers who receive our mailign list!

Custom Edit Form Sections API

Since we've built out a few add-ons to extend the base functionality, we've also built out an API to allow users to rapidly define custom sections on the edit form screen. This allows you to assign additional data to your forms.

We use this API extensively to build out additional sections on the edit form page.

Example:

First hook in to the proper locations, and attach a function:

add_action( 'yikes-mailchimp-edit-form-section-links' , 'add_custom_section_link' );
add_action( 'yikes-mailchimp-edit-form-sections' , 'render_custom_section' );

Next , define your sections and fields by passing in a multi-dimensional array.

/* Add custom link to the links (next to fields & custom messages) */
public function add_custom_section_link() {
    // creating a new link on the edit form page
    Yikes_Inc_Easy_Mailchimp_Extender_Helper::add_edit_form_section_link( array(
        'id' => 'custom-section', // section id
        'text' => 'Custom Section', // the text that will display in the link
        'icon' => 'admin-appearance' // dashicon icon class
    ) );

    // creating a new link on the edit form page
    Yikes_Inc_Easy_Mailchimp_Extender_Helper::add_edit_form_section_link( array(
        'id' => 'custom-section-2', // section id
        'text' => 'Custom Section 2', // the text that will display in the link
        'icon' => 'admin-appearance' // dashicon icon class
    ) );
}

/* Add custom section associated with link created above */
public static function render_custom_section() {
    // defining a new section, associated with the link above
    Yikes_Inc_Easy_Mailchimp_Extender_Helper::add_edit_form_section( array(
        'id' => 'custom-section',  // section id (must match link id above)
        'main_title' => 'Main Section Title', // title of the main block of this custom section
        'main_description' => __( 'This is a custom description for the main section' , 'test' ),
        'main_fields' => array(
            array(
                'label' => 'Custom Field #1', // label text for this field
                'placeholder' => 'Placeholder Value',  // placeholder value for the input field
                'type' => 'text', // type of field (text,select,checkbox,radio)
                'id' => 'custom-field-1', // field id - determines how data is saved in database
                // 'description' => __( 'Testing custom description for field #1' , 'test' ), // field description
            ),
            array(
                'label' => 'Custom Field #2', // label text for this field
                'placeholder' => 'Placeholder Value #2', // placeholder value for the input field
                'type' => 'text', // type of field (text,select,checkbox,radio)
                'id' => 'custom-field-2', // field id - determines how data is saved in database
                'description' => __( 'Testing custom description for field #2' , 'test' ), // field description
            ),
        ),
        'sidebar_title' => 'Sidebar Section Title', // sidebar title of the sidebar section
        'sidebar_description' => __( 'This is a custom description for the sidebar section' , 'test' ),
        'sidebar_fields' => array(
            array(
                'label' => 'Dropdown Field',
                'type' => 'select',
                'options' => array(
                    '1' => 'one',
                    '2' => 'two',
                    '3' => 'three',
                ),
                'id' => 'select-field',
                'description' => __( 'this is a select field.' , 'test' ),
            ),
        ),
    ) );
}