Hello @lesleysim,
You’re welcome. Unfortunately, right now there is no easy way to add a new field to the contact form because it wasn’t built to be so flexible. Maybe in a future release of the plugin… we will make the form more flexible.
Edit steps:
1. copy wp-maintenance-mode/views/maintenance.php
to wp-content/wp-maintenance-mode.php
and add the field in the contact form div;
2. copy wp-maintenance-mode/views/contact.php
to wp-content/wp-maintenance-mode-contact.php
and add the $_POST field where you need;
3. add the next snippet in your <current theme>/functions.php file (because it is necessary to change the contact template path).
function alter_wpmm_contact_template($path){
return WP_CONTENT_DIR . '/wp-maintenance-mode-contact.php';
}
add_filter('wpmm_contact_template', 'alter_wpmm_contact_template');
Thanks.
Thanks George!
wp-content/wp-maintenance-mode.php
or wp-content/wp-maintenance-mode-contact.php
files don’t exist.
There is a wp-maintenance-mode/wp-maintenance-mode.php
file though. Should I create a wp-maintenance-mode-contact.php
in wp-maintenance-mode/
?
Or create both of those files in wp-content/
?
Thank you!
Also, I’m not sure if it matters but previously, I amended both wp-maintenance-mode/views/contact.php
and wp-maintenance-mode/views/maintenance.php
. Which let me fill out the form on the website and there was a space for it in the email, but there was no data captured and the field was empty.
Yes, you have to create those files… in wp-content
directory. Actually you have to copy them from the plugin’s directory to the wp-content
directory an rename them as I said.
Take a look at this gist (maybe you’ll understand): https://gist.github.com/georgejipa/a65479b11639cf84c9e824db073fdc59