The confusion may be due the fact that the ID of the VWM Polls fieldtype in my example code is not “poll”, and instead it is “poll_1”.
Adding a poll to an existing channel is almost exactly the same as creating a new channel just for polls. The only difference is that you do not have to create a new channel or templates. All the other steps are the same.
Assume you have the channel “my_awesome_channel” and the channel field group “My Awesome Channel Field Group” assigned to “my_awesome_channel”. In “My Awesome Channel Field Group” you must create a new channel field, for the sake of example, “my_awesome_poll” with the type of VWM Polls.
Then when you go to the publish page for “my_awesome_channel” you will be able to enter your poll data.
Assuming you only want some entries to have a poll you should be able to check with some code like this:
{if my_awesome_poll} [insert your poll code] {/if}
Then in my example code on GitHub you would use “my_awesome_poll” in place of “poll_1” and the channel “my_awesome_channel” instead of “polls”.
As far as snipets go - I rarely use them. I would just place all this code in an individual template. I think creating a bunch of snipets just makes things more complicated then they have to be. That may just be personal preference, however.
|