badgerherald / student-choice

Plugin to run student choice awards
1 stars 0 forks source link

Create shortcode. #2

Open wjhdev opened 9 years ago

wjhdev commented 9 years ago

Create shortcode to output a radio input block. Something like:

[poll-question poll="student-choice-2015" choice="1" choice="2" choice="3" ...]

mjneil commented 9 years ago

I think the best route with this is is two shortcodes, something along the lines of

[poll name="student-choice-2015]
[poll-question question="Best Bar" choice="1" choice="2" ...]
[/poll]

this way we can make sure all the questions are within a <form> </form> element

wjhdev commented 9 years ago

Yeah. That's kind of what I was thinking too.

wjhdev commented 9 years ago

Although for the question= attribute, I would use a slug encoding. Let's just use h3 headers to print the text of the question.

So:

[poll name="student-choice-2015"]

<h3>Best Bar</h3>

[poll-question question="best-bar" choice="1" choice="2" ...]

Do we need an "end poll" option too? We're going to have to figure out how to avoid the same identifier being used multiple times. Maybe append the post id to the end of it in the database?