Voting on the site - very useful and necessary element, which gives it a shade of web project has an active live audience. In addition to visual effects, polls, of course, can be useful for clarifying the real opinion of site visitors to a particular issue. For all the time using wordpress for their projects, we can say that I used the ballot in three cases - a small mini-survey in a separate article, the global case the vote tabulation, and with the same theme poll, but it created a "purely for show."
In all three cases I have used is probably one of the best modules for a system of questionnaires wordpress - plugin WP-polls . The project has WordPress inside I once examined in detail the process of installing it, and the use of the blog. If you encounter it for the first time, you can follow the link above and explore in more detail, for advanced users only recall the main points.
Once downloaded the wp-polls to the official site and connect the plug-in your admin will be a separate section for polls (Polls). There you can:
- Manage the votings in the blog - open, close, create, view and voice, etc.
- Ask a lot of visual characteristics for displaying voting.
- Use customizable templates for different situations (Poll Templates)
In general, the wp-polls voting is displayed using the get_poll , and the general syntax of its output in a template can be set as follows:
<?php if (function_exists('vote_poll') && !in_pollarchive()): ?>
<?php display_polls_archive_link(); ?>
<?php endif; ?>
If the voting will not work, then most likely a problem in the footer where you want to add this line:
<?php wp_footer(); ?>
The site developer is a statement about the use of plug-in code where there is plenty of interesting nuances. I will focus on those examples, which are said in the beginning.
Mini poll in a separate article
This vote concerned only the article and was located directly in it. To install such a poll should be added to the text of the post
Where 2 - ID created by a vote. In this case, by the way, you can also use the additional options - if you specify 2, then shows a random survey, and for
[poll id="2" type="result"]
Global thematic survey of the blog
Almost all the blogs I have a category of posts, "Polls" where I place an article summing up of various polls. This approach has several advantages - first, you have a topic for additional articles about once a month, and secondly, for each survey you can not only know the result, but also discuss it in the comments.
The structure of the post is always composed of three phases:
- Summarizing the previous survey - text + image.
- Introduction of a new vote.
- Explanation of position, and the choice made.
Global Survey "to form"
Here, the main chip that I use is to create multiple polls on the subject. For example, we subject the project car, you can think of going down to vote on that, "what are your favorite brands of cars," "how do you feel about cars" (pedestrian, just learning, there is a law, no car, I can not live without a car), etc. nAfter creating a 04.03 go to polls Poll Options menu and in the block indicate Current Active Poll
In this case, the use of standard code to display the archive (given at the beginning) will display a random survey for different visitors. Although, of course, you can set it out of the box, using a special parameter to the function:
<?php get_poll(-2); ?>
Also in the settings in the picture above you can see the block Poll Archive. You can easily organize a separate page as an archive of all the polls and vote in the blog. To do this:
- Create a new page with the headline and write any links to something like pollsarchive or any other name (but it will need to remember)
- The text of the page write:
- Then in the settings wp-polls to specify the path to this page.