Skip to content

Instantly share code, notes, and snippets.

@backflip
Created November 27, 2011 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save backflip/1397445 to your computer and use it in GitHub Desktop.
Save backflip/1397445 to your computer and use it in GitHub Desktop.
WP-Polls Templates
<!--
WP-Polls allows for template settings (/wp-admin/admin.php?page=wp-polls/polls-templates.php). To match the design, the following definitions were used on our dev environment.
Since WP-Polls doesn't play nice with WPML, a custom JavaScript solution was chosen to translate the strings. Every element of a poll which has the class 'localize' is searched for a data attribute with the current language and the text is replaced accordingly.
Example: <button type="submit" class="localize" data-de="Abstimmen">Vote</button>
-->
<!-- Voting Form Header -->
<h4>%POLL_QUESTION%</h4>
<span class="total">(<span class="localize" data-de="Bislang"></span> %POLL_TOTALVOTERS% <span class="localize" data-de="Teilnehmer">participants</span>)</span>
<div id="polls-%POLL_ID%-ans" class="questions">
<ul>
<!-- Voting Form Footer -->
</ul>
<div><button type="button" name="vote" onclick="poll_vote(%POLL_ID%);" class="localize" data-de="Abstimmen">Vote</button></div>
<div><a href="#ViewPollResults" onclick="poll_result(%POLL_ID%); return false;" title="View Results Of This Poll" class="localize" data-de="Resultate ansehen">View Results</a></div>
</div>
<!-- Result Header -->
<h4>%POLL_QUESTION%</h4>
<span class="total">(<span class="localize" data-de="Bislang"></span> %POLL_TOTALVOTERS% <span class="localize" data-de="Teilnehmer">participants</span>)</span>
<div id="polls-%POLL_ID%-ans" class="results">
<ul>
<!-- Result Body (not voted) -->
<li>
<span class="answer">%POLL_ANSWER%</span>
<span class="votes">(%POLL_ANSWER_VOTES% <span class="localize" data-de="Stimme(n)">Votes</span>)</span>
<div class="bar-outer">
<span class="bar" style="width: %POLL_ANSWER_IMAGEWIDTH%%;" title="%POLL_ANSWER_TEXT%"></span>
<span class="percentage">%POLL_ANSWER_PERCENTAGE%%</span>
</div>
</li>
<!-- Result Body (voted) -->
<li>
<span class="visuallyhidden" class="localize" data-de="Sie haben folgende Option gewählt">You Have Voted For This Choice</span>
<span class="answer">%POLL_ANSWER%</span>
<span class="votes">(%POLL_ANSWER_VOTES% <span class="localize" data-de="Stimme(n)">Votes</span>)</span>
<div class="bar-outer">
<span class="bar" style="width: %POLL_ANSWER_IMAGEWIDTH%%;" title="%POLL_ANSWER_TEXT%"></span>
<span class="percentage">%POLL_ANSWER_PERCENTAGE%%</span>
</div>
</li>
<!-- Results Footer (not voted) -->
</ul>
<div><a href="#VotePoll" onclick="poll_booth(%POLL_ID%); return false;" class="localize" data-de="An der Umfrage teilnehmen">Vote</a></div>
</div>
<!-- Results Footer (voted) -->
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment