Created
August 21, 2015 16:14
-
-
Save jprieton/3de3e1c03660f4d57672 to your computer and use it in GitHub Desktop.
user_poll_vote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="col-sm-6" action="<?php echo admin_url('admin-ajax.php') ?>" method="post"> | |
<?php | |
$poll = current(get_posts('post_type=poll&posts_per_page=1')); | |
$poll_options = (array) get_post_meta($poll->ID, '_poll_options', TRUE); | |
?> | |
<input type="hidden" name="poll_id" value="<?php echo $poll->ID ?>"> | |
<input type="hidden" name="action" value="user_poll_vote"> | |
<?php wp_nonce_field('user_poll_vote') ?> | |
<?php | |
foreach ($poll_options as $key => $value) { | |
?> | |
<div class="radio"> | |
<label for="poll-option-<?php echo $key ?>"> | |
<input type="radio" name="poll_vote" id="poll-option-<?php echo $key ?>" value="<?php echo $key ?>"> <?php echo $value ?> | |
</label> | |
</div> | |
<?php | |
} | |
?> | |
<button type="submit" class="btn btn-primary" id="poll-vote-button">Votar</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment