You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently WP-Polls works by letting the poll admin feeding each poll with manually entered text answers.
My proposal is to implement an alternative feature - not changing anything to the current plugin's way of working which would remain the default one - that would enable the use of post type objects rather than text strings as answers.
For a basic random example, let's say I have a custom post type named personalities and I want to ask people to vote who they find the most inspiring among a selection:
I go in WP-Polls to "Add New Poll"
I chose the answer mode "objects" (instead of default "text")
I add a set of personalities objects using a post picker in WP-Polls
I select which personalities objects's fields should be used in the template, say title and thumbnail
and as a result the audience will see a poll looking like that example picture (found on the Internet):
This is a basic example and that would allow more sophisticated use cases with multiple custom fields. I have actually already started working on this and would like to know whether@lesterchan (thanks for all the work on that plugin by the way) would find interest in merging such feature ?
The implementation roadmap I have in mind is:
Create a post picker (post list should be filterable by post types and terms of given taxonomy)
Add the answer_type column to the database (both in pollq and polla tables) so that for a given poll ID all answers can be fetched depending of the selected answers type (text or objects) at poll creation's screen.
Add 3 alternative dedicated template boxes to polls-templates.php
a. voting form's body [objects]
b. results body [user voted] [objects]
c. results body [user not voted] [objects]
List available fields for selected post types and convert them in template variables (e.g. %POLL_ANSWER_MY_CUSTOM_FIELD%). Here I am less confident in being able to neatly encompass all possible use cases:
a. So either we consider this would remain an advanced feature to be used by people who are ready to deal with PHP Wordpress' filters to extend the plugin and generate the variables they need for their template.
b. or I look forward to implement a field picker
It would offer the following fields (wordpress filters would still be available for more specific cases):
- post title
- post date
- post excerpt (after checking whether current post type has support for this feature)
- post thumbnail (after checking whether current post type and current theme have support for this feature)
- all custom fields stored in wp_postmeta (excluding hidden ones which I found to be all irrelevant enough in my test blog) - my tests show that it would work at least with custom fields created manually or via ACF (not tested with last ACF version though) ,
A button could be pressed from add/edit poll screens to display a green & red matrix allowing to preview whether selected fields would work with selected posts type items (i.e. check that values are not empty and indicate mime type of files if it deals with attachments for a given custom field).
Best regards,
oleole39
The text was updated successfully, but these errors were encountered:
Hello,
Currently WP-Polls works by letting the poll admin feeding each poll with manually entered text answers.
My proposal is to implement an alternative feature - not changing anything to the current plugin's way of working which would remain the default one - that would enable the use of post type objects rather than text strings as answers.
For a basic random example, let's say I have a custom post type named
personalities
and I want to ask people to vote who they find the most inspiring among a selection:personalities
objects using a post picker in WP-Pollspersonalities
objects's fields should be used in the template, saytitle
andthumbnail
This is a basic example and that would allow more sophisticated use cases with multiple custom fields. I have actually already started working on this and would like to know whether @lesterchan (thanks for all the work on that plugin by the way) would find interest in merging such feature ?
The implementation roadmap I have in mind is:
pollq
andpolla
tables) so that for a given poll ID all answers can be fetched depending of the selected answers type (text
orobjects
) at poll creation's screen.polls-templates.php
a. voting form's body [objects]
b. results body [user voted] [objects]
c. results body [user not voted] [objects]
a. So either we consider this would remain an advanced feature to be used by people who are ready to deal with PHP Wordpress' filters to extend the plugin and generate the variables they need for their template.
b. or I look forward to implement a field picker
- post title
- post date
- post excerpt (after checking whether current post type has support for this feature)
- post thumbnail (after checking whether current post type and current theme have support for this feature)
- all custom fields stored in wp_postmeta (excluding hidden ones which I found to be all irrelevant enough in my test blog) - my tests show that it would work at least with custom fields created manually or via ACF (not tested with last ACF version though) ,
Best regards,
oleole39
The text was updated successfully, but these errors were encountered: