Democracy is the ultimate WordPress polling plugin. This document contains a quick guide to using Democracy.
democracy
into the plugins folder (/wp-content/plugins/) of your WordPress installation. Do not use the folder Democracy
, use the folder inside it.Democracy
.
This step provides instructions for adding Democracy as an item on your sidebar. If you only want polls within posts or pages, you may skip this step and use #6.
If your theme supports Widgets (if you can navigate to Presentation > Sidebar Widgets
):
widget_democracy.php
file to your Widgets folder (/wp-content/plugins/widgets/
)If you don't have widgets:
/wp-content/themes/***YOUR-THEME***/sidebar.php
) file<?php jal_democracy() ?>
where you want Democracy to appear.Congratulations! Democracy is ready to go. Below is a list of optional installation procedures.
{democracy:*}
in the Write screen wherever you want to display a poll. The *
corresponds to a poll ID, so if you want to use poll ID 15, you post would resemble bla bla bla bla {democracy:15} bla bla bla
. The poll ID can be found in the Democracy Poll admin panel, by looking at the first column of the table of polls. To use the current poll, just write {democracy}
.{democracy_archives}
If you have a version of Democracy 1.x, use the following instructions:
democracy
folder (/wp-content/plugins/democracy/
) on your server.democracy
into your plugins folder (/wp-content/plugins/
) of your WordPress installation.All of the functions listed below can be used with no arguments, as is default. Adding arguments allows you to customize Democracy to a greater extent.
jal_democracy()
function$id
: ID of the poll you want to display. If none is specified, it defaults to 0
, which is then converted to mean the current poll (as specified in your admin panel).$before_title
: The HTML that will precede the title (the question) of a poll. If none is specified, it defaults to false
, which is then converted to the HTML you specified in the admin panel (or the default if you haven't changed it).$after_title
: The same as $before_title
, but following the title. Typically, this is the closing HTML tag of the tag found in $before_title
.Democracy
objectsDemocracy
object:
$poll = new Democracy($id, $before_title, $after);
: uses the same parameters as the jal_democracy()
function. See above. The difference is that creating an object does not automatically display the poll.$poll->display($showVoteScreen);
: The display
method returns a string of HTML code. The parameter $showVoteScreen
is a boolean that decides whether to show the Vote screen or the Results screen. Default: true
, but the user must not have already voted or it will show the Results page anyway.jal_democracy_archives()
functionget_jal_democracy_archives()
if you want to have your data returned instead of printed. This function can take some optional parameters:
$show_current
: Determines whether to show the poll currently in progress now (as specified in Democracy Poll admin panel). If set to true
, it will show a normal voting box for the poll (and will show the results page if the user has already voted). The current poll will appear first in the list. If false
, as is default, the list will not contain the current poll.$before_title
: The HTML that will precede the title (the question) of each poll. If none is specified, it defaults to false
, which is then converted to the HTML you specified in the admin panel (or the default if you haven't changed it).$after_title
: The same as $before_title
, but following each title. Typically, this is the closing HTML tag of the tag found in $before_title
.jal_democracy()
function
<?php jal_democracy(25, '<div class="title">', '</div>'); ?>This example will print the poll of ID
25
and surround the title of the poll with <div class="title">
and </div>
.
Democracy
object:
<?php $poll = new Democracy(9, '<h3>', '</h3>'); $poll->active = false; echo $poll->display(false); ?>This example will print the results screen of the poll with ID 9 and the title will appear like:
<h3>Example Title</h3>
. The $poll->active
part makes the poll 'inactive', meaning it can't be voted on. If this code were not there, then a 'Back to Vote Screen' link would appear for users who haven't voted yet.
jal_democracy_archives()
function
<?php jal_democracy_archives(true, '<strong>', '</strong>'); ?>This example will show a list of results on all the past polls. It will not allow users to vote on past polls.
basic.css
and style.css
. CSS stylesheets control the look of your page. The basic.css
file contains general Democracy styles that format the poll without specifying colors or other things that vary widely in different websites. The style.css
file contains specific styles meant to make Democracy mesh with your site. If you are unhappy with the looks of Democracy, style.css
is the file you should edit. I've tried to lay it out so it's easy to change, but if you are unfamiliar with CSS, it may be hard. If you want some specific design, try getting support from the WordPress forum./wp-content/plugins/democracy/style.css
. At the bottom you should see:
/* .democracy ul li { list-style: none; background: none; } */Remove the
/*
and */
lines.
<head>
of your page. To verify this, View Source
of a page and see if there is anything that says <!-- Added By Democracy Plugin ...
If its not there, edit /wp-content/themes/***YOUR-THEME***/header.php
and somewhere in the <head>
, add this code: <?php wp_head(); ?>
. This code basically allows Plugins to add css and javascript references very easily. MOST themes include it, but some neglect to.Support is tough. I really want to help everyone, but my busy high school schedule doesn't leave me a lot of time for everyone. That said, you can get support in the following ways.
I read all of my email, but I often don't respond to it. The best way to get me is by AIM, where I can't escape you! :).