WordPress.org

Ready to get started?Download WordPress

Forums

WP-Polls
[resolved] Can I add a class parameter to wp-polls's shortcode? (7 posts)

  1. erknrio
    Member
    Posted 9 months ago #

    I have 2 polls, one with a widget in the main page of my site and other in a post.

    Widget poll:
    http://i.imgur.com/I9IN0Nv.jpg
    Post poll:
    http://imgur.com/I9IN0Nv,0nylT0x#1

    I need differents css for each poll but if I modify the "Poll Voting Form Templates" it change the widget poll and the post poll (that is a problem).

    Can I add a class parameter to load a custom css class? For example:

    [poll id="12" class="post-poll"]

    Other thing: where is the code of the post-poll shortcode? I can add a css class in this code to change header, content and footer :-).

    Thank you very much for your help.

    http://wordpress.org/plugins/wp-polls/

  2. Lester Chan
    Member
    Plugin Author

    Posted 9 months ago #

    Why you need to pass it through shortcode?

    You can use #sidebar .wp-polls to target your wp-polls on your sidebar and .post-content .wp-polls to target the polls in your post content?

    The shortcode is line 737 https://github.com/lesterchan/wp-polls/blob/master/wp-polls.php#L737

  3. erknrio
    Member
    Posted 9 months ago #

    Ok thanks for the reply, but if I use the tinymce shortcode like this:
    [poll id="12"]

    Where I can add this classes? I need to add a specific css to all the poll and the poll's questions like this (I wrote my custom class in upper case):

    <div id="polls-12" class="wp-polls MY-CUSTOM-POLL-POST-CLASS">
    	<form id="polls_form_12" class="wp-polls-form" action="/index.php/prueba/" method="post">
    		<p style="display: none;"><input type="hidden" id="poll_12_nonce" name="wp-polls-nonce" value="649900112a"></p>
    		<p style="display: none;"><input type="hidden" name="poll_id" value="12"></p>
    		<p class="MY-CUSTOM-CLASS-QUESTION" style="text-align: center;"><strong>Top 10 Partido 2</strong></p>
    		<div id="polls-12-ans" class="wp-polls-ans">
    			<ul class="wp-polls-ul">
    				<li><input type="radio" id="poll-answer-39" name="poll_12" value="39"> <label for="poll-answer-39">Equipo 1</label></li>
    				<li><input type="radio" id="poll-answer-40" name="poll_12" value="40"> <label for="poll-answer-40">Equipo 2</label></li>
    			</ul>
    		<p style="text-align: center;"><input type="button" name="vote" value="   Vote   " class="Buttons" onclick="poll_vote(12);"></p><p style="text-align: center;"><a href="#ViewPollResults" onclick="poll_result(12); return false;" title="View Results Of This Poll">Ver Resultados</a></p></div>
    	</form>
    </div>

    I don't know how to do that. Sorry but I am very confused.

    *Sorry for my english I am spanish and I write a very basic english :S.

  4. Lester Chan
    Member
    Plugin Author

    Posted 9 months ago #

    Sorry I don't provide support to modifications to the plugin because the modification you want is not as straightforward. As I mentioned, this can be done via CSS. You do not need to touch the plugin code at all.

  5. erknrio
    Member
    Posted 9 months ago #

    But, if this css classes don't work? I use it in the file polls-css.css:

    .post-content{
    /*my css*/
    }
    
    .post-content .wp-polls{
    /*my css*/
    }
  6. Lester Chan
    Member
    Plugin Author

    Posted 9 months ago #

    I am assuming your theme is using .post-content to style the post content area, you will need to check your theme, because I will not know what CSS class it is using.

  7. erknrio
    Member
    Posted 9 months ago #

    You should have started there xD.
    #content-area is in my template. It works, thank you very much :).

Reply

You must log in to post.

About this Plugin

About this Topic