While building the refreshable lists feature of the Ninja Forms THREE newsletter action, I wanted to provide some visual feedback while awaiting the response from the server with the new list content. I’m normally the PHP developer at the office, with James as the CSS developer, so I reached out to him to add the CSS for a spinning dashicon.
Content Management Systems are great for managing content, with means to create, modify, and delete pages/posts easily. However, sometimes as developers we need to leverage the displaying of content outside of the normal system (read: user facing system). For example, Ninja Forms, the Drag and Drop Form Builder for WordPress, has a feature for previewing forms as they would be displayed in your theme. In order to display a preview of the form on the front end of the website we created a page, using the WordPress page post type, then filtered the content of that page with the contents of the form. This worked great during in-house development, however there are complications when deployed to 200,000+ user websites.
While re-writing Field Class Registration for Ninja Forms 3.0, one of my goals was to clean up the file structure for adding fields. Previously, in Ninja Forms 2.*, new fields were created with procedural PHP, long argument arrays, and prefixed WordPress action hooks. These files were large, messy, and a burden to maintain. As a part of the re-write process, we were able to step back and take a fresh approach for registering new form fields with the Ninja Forms drag-and-drop form builder.
Have you ever wanted to use that cool AJAX thing, what ever it is? You know, that cool thing that all the cool kids are using? What is AJAX, anyway?
Here is a little detail on how I setup my development environment for WordPress plugin development.
Ninja Forms offers two premium extensions for creating posts on form submission. Front End Posting and Front End Editor both contain this functionality (note: The two extensions cannot be activated at the same time, as Front End Editor contains Front End Posting).
When a post is created from a submission, the ID of that created post is saved as a form setting in the `$ninja_forms_processing` global variable. This value is available during the ninja_forms_post_processing hook:
Ninja Forms uses the jQuery UI Datepicker to add datepicker fields to forms. jQuery is bundled with WordPress, so the jQuery UI Datepicker is an easy choice. However, the datepicker defaults still need to be localized. In the short term, I have put together a plugin that helps to localize the datepicker defaults for Ninja Forms. Note: The plugin currently has limited language support based on immediate customer needs, but can be easily updated as those needs change.