On every page of my site I got a contact form that will send an email to the respective address. On this site also I've set the front page display to a static page.
The contact form will basically post to self and if successful will take the user to a new page, otherwise will anchor down to the contact form and display the error. But on the home page, be it any type of POST request, it will set the page to the posts page. Seems bizarre to me as it can be an empty POST request and still take the user back to the posts page but the URL won't change. This only happen if you do a POST to the homepage, all other pages work as expected.
Any ideas?
add_action( 'wp_head', 'process_contact_form' );
function process_contact_form() {
if( isset( $_POST['submit'] ) && $_POST['submit'] ) {
echo'test';
}
}
add_shortcode( 'mini-contact', 'get_mini_contact' );
function get_mini_contact( $atts = array() ) {
extract(shortcode_atts(array(
'title' => 'Contact US',
'button' => 'Submit',
'label' => 'Message us',
'subject' => 'Message'
), $atts));
$html = '';
$html .= '<section id="quick-contact-form" class="home-solution">';
$html .= '<div class="container">';
$html .= '<header>';
$html .= '<h2 class="aligncenter type--bottom-space">' . $title . '</h2>';
$html .= '</header>';
$html .= '
<form class="contact-form" method="post" action="">
<div class="row">
<div class="medium-5 columns">
<label>Name</label>
<input type="text" name="name" class="form-contact__text" />
</div>
<div class="medium-5 columns">
<label>E-mail</label>
<input type="text" name="email" class="form-contact__text" />
</div>
</div>
<div class="row">
<div class="medium-10 columns">
<label>Share your business problem today</label>
<textarea name="comment" rows="20" class="form-contact__textarea"></textarea>
</div>
</div>
<div class="row">
<div class="medium-10 columns">
<input type="submit" name="submit" value="' . $button . '" class="button expand">
</div>
</div>
<input type="hidden" name="subject" value="' . $subject . '">
</form>
';
$html .= '</div>';
$html .= '</section>';
return $html;
}
Settings -> Reading
? What are Front page displays, Front page, and Posts page?