WP-Polls

Descripción

WP-Polls es tremendamente personalizable mediante plantillas y estilos css, y hay montones de opciones que puedes elegir para asegurar que WP-Polls funciona como tú quieras. Ahora es compatible con la selección múltiple de respuestas.

Desarrollo

https://github.com/lesterchan/wp-polls

Agradecimientos

Donaciones

Paso la mayor parte de mi tiempo libre creando, actualizando, manteniendo y dando soporte a estos plugins, si de verdad te encantan mis plugins y puedes soltarme un par de pavos te lo agradeceré de veras. En caso contrario sé libre de usarlo sin obligación alguna.

Capturas

  • Administración: todas las encuestas
  • Administración: gestión de encuestas
  • Administración: opciones de encuesta
  • Administración: plantillas de encuesta
  • Administración: widget de encuesta
  • Administración: desinstalar encuesta
  • Encuesta: encuesta de respuesta simple
  • Encuesta: encuesta de varias respuestas
  • Encuesta: Resultados
  • Encuesta: archivo

Preguntas frecuentes

Uso general (sin widget)

<?php if ( function_exists( 'vote_poll' ) && ! in_pollarchive() ): ?>
    <li>
        <h2>Polls</h2>
        <ul>
            <li><?php get_poll();?></li>
        </ul>
        <?php display_polls_archive_link(); ?>
    </li>
<?php endif; ?>
  • Para mostrar una encuesta concreta usa <?php get_poll(2); ?> donde 2 es el ID de tu encuesta.
  • Para mostrar una encuesta al azar usa <?php get_poll(-2); ?>
  • Para insertar una encuesta concreta en tu entrada usa [poll id="2"] donde 2 es el ID de tu encuesta.
  • Para insertar una encuesta al azar en tu entrada usa [poll id="-2"]
  • Para insertar el resultado de una encuesta concreta en tu entrada, utiliza [poll id="2" type="result"] donde 2 es el ID de tu encuesta.

Uso general (con widget)

  1. Ve a WP-Admin -> Apariencia -> Widgets.
  2. Puedes añadir el widget de encuestas haciendo clic en el enlace «Añadir» a su lado.
  3. Después de añadirlo puedes configurar el widget de encuestas haciendo clic en el enlace «Editar» que tiene al lado.
  4. Haz clic en «Guardar los cambios».
  5. Sigue bajando para ver las instrucciones sobre cómo crear el archivo de encuestas.

¿Cómo creo el archivo de encuestas?

  1. Ve a WP-Admin -> Páginas -> Añadir nueva.
  2. Pon el título que quieras en el área de título de la entrada.
  3. Si estás usando enlaces permanentes bonitos, después de poner el título, WordPress generará el enlace permanente a la página. Verás un enlace de «Editar» justo al lado del enlace permanente.
  4. Haz clic en «Editar» y escribe pollsarchive en el campo de texto y haz clic en «Guardar».
  5. Escribe [page_polls] en el área de contenido de la entrada.
  6. Haz clic en «Publicar».
  • Si NO estás usando enlaces permanentes bonitos tendrás que ir a WP-Admin -> Encuestas -> Opciones de encuesta y bajo Archivo de encuestas -> URL del archivo de encuestas, tendrás que poner como URL la de la página que hayas creado arriba para que sea el archivo de encuestas.

¿Por qué las respuestas de mi encuesta no suman el 100%?

  • Esto es debido a problemas de redondeo. Para hacer que siempre redondee al 100%, la última respuesta de la encuesta tomará el porcentaje restante que se le ha añadido. Para activar esta característica, añade esto al archivo functions.php de tu tema: add_filter( 'wp_polls_round_percentage', '__return_true' );

¿Cómo se carga el CSS de WP-Polls?

  • WP-Polls cargará polls-css.css del directorio de tu tema, si existe.
  • Si no existe simplemente carga el polls-css.css por defecto que viene con WP-Polls.
  • Este te permitirá actualizar WP-Polls sin preocuparte porque se sobrescriban tus estilos de encuestas que hayas creado.

¿Por qué en Internet Explorer (IE) el texto de la encuesta se ve mal?

  • Para resolver este problema abre poll-css.css
  • Encuentra: /* background-color: #ffffff; */
  • Reemplaza: background-color: #ffffff; (donde #ffffff debería ser el color de fondo de tu encuesta.)

¿Cómo le pongo colores distintos a cada barra de la encuesta?

  • Courtesía de TreedBox.com
  • Abre poll-css.css
  • Añade al final del archivo:
.wp-polls-ul li:nth-child(01) .pollbar{ background:#8FA0C5}
.wp-polls-ul li:nth-child(02) .pollbar{ background:#FF8}
.wp-polls-ul li:nth-child(03) .pollbar{ background:#ff8a3b}
.wp-polls-ul li:nth-child(04) .pollbar{ background:#a61e2a}
.wp-polls-ul li:nth-child(05) .pollbar{ background:#4ebbff}
.wp-polls-ul li:nth-child(06) .pollbar{ background:#fbca54}
.wp-polls-ul li:nth-child(07) .pollbar{ background:#aad34f}
.wp-polls-ul li:nth-child(08) .pollbar{ background:#66cc9a}
.wp-polls-ul li:nth-child(09) .pollbar{ background:#98CBCB}
.wp-polls-ul li:nth-child(10) .pollbar{ background:#a67c52}
.wp-polls-ul li .pollbar{ transition: background 0.7s ease-in-out }
.wp-polls-ul li .pollbar:hover{ background:#F00 }

Para mostrar el total de encuestas

<?php if ( function_exists( 'get_pollquestions' ) ): ?>
    <?php get_pollquestions(); ?>
<?php endif; ?> 

Para mostrar el total de respuestas a la encuesta

<?php if ( function_exists( 'get_pollanswers' ) ): ?>
    <?php get_pollanswers(); ?>
<?php endif; ?> 

Para mostrar los votos totales de la encuesta

<?php if ( function_exists( 'get_pollvotes' ) ): ?>
    <?php get_pollvotes(); ?>
<?php endif; ?> 

Para mostrar los votos de la encuesta por ID

<?php if ( function_exists( 'get_pollvotes_by_id' ) ): ?>
    <?php get_pollvotes_by_id($poll_id); ?>
<?php endif; ?>

Para mostrar los votantes totales de la encuesta

<?php if ( function_exists( 'get_pollvoters' ) ): ?>
    <?php get_pollvoters(); ?>
<?php endif; ?> 

Para mostrar el tiempo de la encuesta por ID y formato de fecha

<?php if ( function_exists( 'get_polltime' ) ): ?>
    <?php get_polltime( $poll_id, $date_format ); ?>
<?php endif; ?>

Translating the template

The plugin templates can be translated via template variables.
There are these filters for the custom template variables

wp_polls_template_votebody_variables
wp_polls_template_votefooter
wp_polls_template_resultheader_variables
wp_polls_template_resultbody_variables
wp_polls_template_resultfooter_variables

Add filter to your theme and register custom variable where you will add your translation.
Good practice is to name them for example with prefix STR_ in the example STR_TOTAL_VOTERS.

    /**
     * Localize wp_polls_template_resultfooter_variables.
     *
     * @param array $variables An array of template variables.
     * @return array $variables Modified template variables.
     */
    function wp_polls_template_resultfooter_variables( $variables ) {

        // Add strings.
        $variables['%STR_TOTAL_VOTERS%'] = __( 'Total voters', 'theme-textdomain' );

        return $variables;
    }

// Trigger the filter
add_filter( 'wp_polls_template_resultfooter_variables', 'wp_polls_template_resultfooter_variables' , 10, 1 );

In the admin side just call the custom variable like so and the variable has been translated in the front-end.
%STR_TOTAL_VOTERS%’

Reseñas

29 de abril de 2023
Hi there, I've been using this plugin and loved it for its simplicity alongside with the ability to customize the look and feel. Somehow, at some point, the admin interface changed and I am now able to see the answers of all users. Before, I was only able to see how many users voted for each answer, not who. This is a major problem for me. Is there any way to hide the usernames from the answers given? I need to see which users voted, but not what answer they gave. The answers should only be seen as a total for each option. Thanks
21 de octubre de 2022
Love the feature set, easy to use, great to work with, but it fails with my cache setup (standard Cloudflare) setup. Have to remove it a site and move to another solution, sadly this was after my install, setting up on my custom post types, etc. Would love to see it updated in the future.
23 de julio de 2022
Excellent, easy going plugin. Thank you.
Leer todas las 135 reseñas

Colaboradores y desarrolladores

«WP-Polls» es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

«WP-Polls» ha sido traducido a 15 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce «WP-Polls» a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

Version 2.77.2

  • FIXED: Read from default REMOTE_ADDR unless specified in options

Version 2.77.1

  • FIXED: Support mutex lock for multi-site. Props @yrkmann.

Version 2.77.0

  • NEW: Use mutex lock to prevent race condition.

Version 2.76.0

  • NEW: Supports specifying which header to read the user’s IP from. Props Marc Montpas.

Version 2.75.6

  • NEW: New filter for template variables: wp_polls_template_votebody_variables, wp_polls_template_votefooter, wp_polls_template_resultheader_variables, wp_polls_template_resultbody_variables, wp_polls_template_resultfooter_variables. Props @Liblastic.
  • NEW: composer.json
  • FIXED: Missing space for check_voted_username MySQL query

Version 2.75.5

  • NEW: New filter for templates: wp_polls_template_resultheader_markup, wp_polls_template_resultbody_markup, wp_polls_template_resultbody2_markup, wp_polls_template_resultfooter_markup, wp_polls_template_resultfooter2_markup. Props @Jaska.

Version 2.75.4

  • FIXED: Unable to edit poll because of class-wp-block-parser.php.

Version 2.75.3

  • FIXED: Broken filter for templates
  • FIXED: Divison by 0 by totalvoters
  • FIXED: Add whitelist to sortby poll answers

Versiob 2.75.2

  • FIXED: Missing str_replace for wp_polls_template filter

Version 2.75.1

  • FIXED: Use array() instead of [] as a few users are still on < PHP 5.4. Props @bearlydoug.
  • FIXED: pollq_expiry is now 0 instead of blank string. Props @hpiirainen.

Version 2.75

  • FIXED: Standardize all filters to begin with wp_polls rather than poll
  • NEW: Added wp_polls_ipaddress and wp_polls_hostname to allow user to overwrite it.

Version 2.74.1

  • FIXED: Don’t use PHP 5.4 Short array syntax.
  • FIXED: Division by zero
  • FIXED: Wrong database column type for pollq_expiry

Version 2.74

  • NEW: Hashed IP and anonymize Hostname to make it GDPR compliance
  • NEW: If Do Not Log is set in Poll Options, do not log to DB
  • NEW: Support %POLL_MULTIPLE_ANSWER_PERCENTAGE%. This is total votes divided by total voters.

Version 2.73.8

  • FIXED: Bug fixes and stricter type checking

Version 2.73.7

  • FIXED: Unable to save input HTML tags for footer templates

Version 2.73.6

  • FIXED: Unable to vote for multiple answers
  • FIXED: input HTML tags being removed when saving templates

Version 2.73.5

  • FIXED: Parsed error in SERVER variable.

Version 2.73.4

  • FIXED: sanitize_key on top of intval.

Version 2.73.3

  • NEW: Added sort by votes casted to poll answers.
  • NEW: For polls with mutiple answers, we divided by total votes instead of total voters. Props @ljxprime.
  • FIXED: Do not display poll option is not respected when poll is closed.
  • FIXED: pollip_qid, pollip_aid, pollip_timestamp are now int(10) in pollsip table.
  • FIXED: pollq_expiry is now int(10) in pollsq table.

Version 2.73.2

  • NEW: Bump WordPress 4.7
  • FIXED: Change cron to hourly instead of twice daily.

Version 2.73.1

Version 2.73

  • NEW: Display Poll Questions at the top of the Poll Logs table
  • FIXED: Remove slashes

Version 2.72

  • NEW: Use translate.wordpress.org to translate the plugin
  • FIXED: SQL Injection fixes. Props Jay Dansand
  • FIXED: Use $wpdb->insert(), $wpdb->update() and $wpdb->delete() as much as possible
  • FIXED Remove poll_archive_show option from UI

Version 2.71

  • FIXED: Use wp_kses_post() to get filter always bad tags

Version 2.70

  • NEW: Add wp_polls_vote_poll_success action hook
  • NEW: Add wp_polls_add_poll, wp_polls_update_poll, wp_polls_delete_poll action hooks
  • FIXED: PHP Notices
  • FIXED: Removed not needed wp_print_scripts
  • FIXED: Use esc_attr() and esc_textarea() instead of htmlspecialchars(). Props Govind Singh