https://github.com/fmikl/wp-contact-form
This project enables the rapid and easy creation of contact forms for WordPress using an object-oriented approach.
https://github.com/fmikl/wp-contact-form
wordpress-developer wordpress-development wordpress-theme
Last synced: about 1 month ago
JSON representation
This project enables the rapid and easy creation of contact forms for WordPress using an object-oriented approach.
- Host: GitHub
- URL: https://github.com/fmikl/wp-contact-form
- Owner: FmiKL
- License: gpl-2.0
- Created: 2023-07-24T12:03:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-08-10T12:37:30.000Z (10 months ago)
- Last Synced: 2025-08-10T14:37:58.506Z (10 months ago)
- Topics: wordpress-developer, wordpress-development, wordpress-theme
- Language: PHP
- Homepage:
- Size: 54.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Contact Form
A lightweight OOP contact form builder for WordPress with Ajax handling.
## Features
- Text, email, tel, url, number, color, checkbox, textarea, select fields
- Grouped fields with custom HTML wrappers
- Automatic mail headers from `email`, `name` and `subject` fields
- Ajax submission with validation and error display
- Nonce + honeypot spam protection
- Test mode on localhost
## Setup
```php
require_once 'path/to/wp-contact-form/autoload.php';
```
## Usage
```php
function setup_form_contact() {
$form = new Contact_Manager( 'form-contact', get_option( 'admin_email' ) );
$form->group_fields(
'
%fields',
$form->add_field( 'text', 'name', 'Name', array(
'wrapper' => '%field',
'input_class' => 'form-control',
'required' => true,
) ),
$form->add_field( 'email', 'email', 'Email', array(
'wrapper' => '%field',
'input_class' => 'form-control',
'required' => true,
) ),
);
$form->add_field( 'textarea', 'message', 'Message', array(
'wrapper' => '
%field',
'input_class' => 'form-control',
) );
$form->add_button( 'Send', array( 'class' => 'btn btn-primary' ) );
$form->create_form();
$form->handle_request();
}
add_action( 'init', 'setup_form_contact' );
```
## License
[GPL v2](LICENSE)