How-to: Inserting a poll into a post

This is something that was asked on the Aussie Bloggers forums, and has been sitting on my to-do list for a couple of days now. It’s a short post, geared to users of the WP-Polls plugin for WordPress.

Basically, there are two ways you can show your polls – in your sidebar via the widget (or by manually editing the sidebar to add some PHP code), or within a post. Depending on the context in which you want your poll, you might want to have it within a post. Here’s how you do it.

First off, if you are wanting it to be a new poll, then you’ll need to make a new poll in the Polls section of your admin panel. For the purposes of this post, I’ve made a timely cricket-related question –

[poll=2]

So, now you can see the poll within the post (RSS readers, you may have to visit the site to see the poll). But how did it get there?

A simple bit of coding, but you don’t need to know anything other than the poll number, as there is a button on your toolbar to insert a poll. Depending on the editor you use, the button itself will vary.

For Advanced TinyMCE users, the button looks like this, on the top row of buttons –

Poll button in Advanced TinyMCE

And, if you have opted to stick with the original TinyMCE editor, this is what the button will look like (yeah, it’s a bit spiffier πŸ˜‰ ) –

Poll button in Regular TinyMCE

All you have to do is click on that button, and a dialog will come up, which looks like this (obviously, the address of the site will be your address) –

Enter Poll ID here

Now, you just have to put in the number of the poll you want to insert. In this case, it was number 2, but if you check out the list of polls on the main Polls page in your administration panel, you will see the Poll ID in the left column –

List of Poll IDs

Simply put that number into the dialog box, and it will insert the code to show that poll. If you’re curious, the code that it will insert is this (broken apart so that it doesn’t show the poll again πŸ˜‰ )

[ poll = {PollID} ]

I made a mention about RSS readers needing to come to the site to view the poll because how WP-Polls works is that it’s actually all run from within the page, with the votes all being logged by the plugin. These are functions that just can’t be replicated in an RSS feed (for the most part). In fact, I did some checking now, and this is the message you will see in place of the poll –

Note: There is a poll embedded within this post, please visit the site to participate in this post’s poll.

There are plugins which will allow you to put a poll in an RSS Feed – Democracy should be able to, according to a reply by Sueblimely in the thread, but I have not personally tested it to verify it. If anyone wants to test it and see if it works on their own blog, or if you use a different plugin for your polls which allows this, feel free to drop a comment. πŸ™‚

8 thoughts on “How-to: Inserting a poll into a post

  1. My thinking is putting a poll in a post is a great time to encourage people to drop by your site to vote. πŸ˜‰ If we put everything in the feed, readers would never visit actual blogs! πŸ™‚

    Cheers,
    Snos

  2. This is what I was looking for.
    Can’t believe it’s so easy and miss that tiny button. πŸ˜€

    Almost getting tired with WP Polls.
    It’s a perfect plugin … at least for my need.

    Thanks

  3. Thanks for the walk through – for the life of me I couldn’t find that “insert poll button” (I looked all over the plugin’s interface but not in the actual post editor itself). This helped though πŸ™‚

Comments are closed.