WordPress.org

Ready to get started?Download WordPress

Forums

Democracy Plugin and RunPHP: Putting polls in every post (9 posts)

  1. mashable
    Member
    Posted 8 years ago #

    I'm having big problems with the democracy plugin for wordpress. I want to put a poll in every post, with a choice between two options. I've tried doing this using RunPHP and putting

    <?php jal_democracy(); ?>

    in each post, with the number of the poll between the brackets, but this doesn't seem to work - the message "Go Stuff the Ballot Box Elsewhere" keeps popping up, even on a new poll, and when you try to vote, you soemtimes receive the error "You Must Vote First!".

    Here are my (feeble) efforts so far:

    http://www.afterandbefore.com

    How do I fix this? Is Democracy the right plugin to use?

  2. skippy
    Member
    Posted 8 years ago #

    I suspect the problem is trying to do the poll on each post as listed on the front page. I experienced the problem you described when clicking "Vote" from the front page for each poll.

    But when I loaded each post individually, I had no trouble voting on each one.

    Maybe place your poll after a <--more--> tag, so that it's only displayed on the single view, and not in the index or archive view?

  3. jalenack
    Member
    Posted 8 years ago #

    Yeah, democracy has trouble with multiple instances on the same page. I believe I mentioned this in the readme.

    Skippy's suggestion is excellent. Anything you can do to have only one poll per page. That should keep democracy from going haywire. I have plans to bring better support for multiple instances, but not in the immediate future.

  4. mashable
    Member
    Posted 8 years ago #

    Thanks for the quick replies. About the more tag: do I just put <--more--> in before the polls? Is this PHP? Presumably this means that you have to click through to the individual post to view the poll.

    Ideally, though, I'd really like to have multiple polls on the front page. Is there another plugin that would allow me to do this, perhaps sacrificing some of the features of democracy?

    PS. Another question just occurred to me - do polls turn up in RSS feeds if you include them in the post? Would it be possible to vote directly from the feed? (Actually, I'd prefer it if users had to visit the site to vote, since I don't want to put ads in the feeds.)

  5. jalenack
    Member
    Posted 8 years ago #

    I suppose you could still use democracy and have it work with multiple instances. You'd have to disable the javascript file it fetches though. Look for the jal_add_to_head() function or something like that, and it should have something that says <script type="text/javascript" src="....> ... Just delete the line that calls the javascript.

    This will disable the cool AJAX loading, but multiple instances on one page will work.

    Your other question: yeah they probably would. You could probably look up some conditional tags Conditional Code that would filter out democracy from RSS. Good luck

  6. mashable
    Member
    Posted 8 years ago #

    Thanks for the reply. I tried WP-polls today, but it had the same problem with multiple polls. I'll put democracy back in there and do as you say.

    I'll keep you posted.

  7. mashable
    Member
    Posted 8 years ago #

    Right - I tried out what you suggested, and I'm still having the same problems with multiple polls. I'm probably deleting the wrong line - could you be more specific about exactly which line I need to delete? Many thanks.

  8. jalenack
    Member
    Posted 8 years ago #

    I see, it sorta works. You've deleted the right line.

    I guess you'll have to use <--more--> so that only one poll can show, or use Conditional Tags (sorry, the link was wrong last time)

    Those are the limitations. I don't think any WP polling option can handle that right now

  9. gunlib
    Member
    Posted 8 years ago #

    Just wanted to say, I appreciated this thread very much. I had the same question as the original poster and the fix worked beautifully. Thanks again...

Topic Closed

This topic has been closed to new replies.

About this Topic