Reply To: Add a "class" to the headings above the contact form

#1746
Stephen Sherrard
Keymaster

You are correct as far as the headers on the contact form… I should have added some classes to those, or a wrapper div at least, with the last update… just super busy with projects here, so put that last update out quickly and didn’t look at the contact form function.

I’ll see if I can push out an update today with a div wrapper around that contact form, as well as some classes for those headings.

However, there are also filter hooks in place to allow other plugins or themes add content before and after the form (including before those headings are output). So, you could add a wrapper div of your own choosing around the contact form without modifying the plugin by adding a couple really simple hooks and functions to your theme’s functions.php file. This is all you would have to do to add your own div wrapper:


function ptamdcf_add_div_start($html, $id, $location) {
	return '<div class="ptamd_contact_form">';
}
add_filter('pta_member_before_contact_form', 'ptamdcf_add_div_start', 10, 3);

function ptamdcf_add_div_end($form_html, $id, $location) {
	return $form_html . '</div>';
}
add_filter('pta_member_before_contact_form', 'ptamdcf_add_div_end', 10, 3);

Also, the nonce and referrer fields are necessary for security and best practices. Those are generated by the built-in wordpress function wp_nonce_field, and the location in my script is actually inside the form, but it looks like I didn’t set the optional third echo argument to false, so it’s echoing those fields before the rest of the form is returned. It still works fine that way, but I’ll change that in the new update.