Conflict between USP Plugin and form
-
Hi. Thank you in advance for this wonderfull plugin!
I need some assistance about a page I’ve been developing with USP plugin. So the idea is to have a page section where the user would click a button and then get a random post from the site archive. This same page would also have another section with a form that allows the user to send posts to the archive (I’m using USP Plugin to make this happen).
The first section and the PHP snippet to randomize posts seem to be working ok. The plugin also works perfectly. Problem is I cannot make these two sections work together. Every time I click on the button, instead of displaying random posts, I get redirected to the USP form on the bottom of the page and receive the warning “Please complete the required fields”.
Now I’m definitely new to PHP, but it looks like my button is also triggering USP Plugin error message. Is there a way to keep both forms on the same page and avoid this unwanted interaction?
I’m pasting my scripts below, in case it helps:
//Button HTML
<form method=”post”>
<input type=”submit” name=”randomize” value=”randomize”/>//PHP Snippet to Randomize Posts On Button Click
<?php
if($_SERVER[‘REQUEST_METHOD’] == “POST” and isset($_POST[‘randomize’])) {
$the_query = new WP_Query( array ( ‘orderby’ => ‘rand’, ‘posts_per_page’ => ‘1’ ) );
while ( $the_query->have_posts() ) : $the_query->the_post();
the_tags ();
the_content();
endwhile;
wp_reset_postdata(); }
?>Thank you very much,
- The topic ‘Conflict between USP Plugin and form’ is closed to new replies.