{"id":2,"date":"2025-11-09T14:55:25","date_gmt":"2025-11-09T14:55:25","guid":{"rendered":"https:\/\/votekenya.co.ke\/?page_id=2"},"modified":"2025-11-09T15:08:13","modified_gmt":"2025-11-09T15:08:13","slug":"sample-page","status":"publish","type":"page","link":"https:\/\/votekenya.co.ke\/index.php\/sample-page\/","title":{"rendered":"voting\/polling"},"content":{"rendered":"\n<style>\n    .tp-vote-container {\n        margin: 20px;\n        padding: 20px;\n        display: grid;\n        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));\n        grid-gap: 1rem;\n        justify-content: center;\n    }\n\n    .vote-item {\n        border-radius: 5px;\n        display: flex;\n        flex-direction: column;\n        justify-content: center;\n        align-items: center;\n        border: 1px solid rgb(115, 187, 8);\n\n\n\n    }\n\n    .vote-item img {\n        max-width: 320px;\n        padding: 20px;\n        border-radius: 5px;\n    }\n\n    .vote-item span {\n        padding-bottom: 10px;\n        font-size: 25px;\n    }\n\n    .vote-item a {\n        padding-bottom: 20px;\n        background-color: rgb(129, 204, 18);\n        padding-top: 10px;\n        width: 100%;\n        text-decoration: none;\n        text-align: center;\n        display: flex;\n        flex-direction: column;\n        color: white;\n        font-size: 24px;\n        font-weight: bold;\n\n    }\n\n    .vote-item a:hover {\n\n        background-color: rgb(104, 170, 4);\n\n    }\n\n    section.tp-search-bar {\n        margin-top: 30px;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n    }\n\n    section.tp-search-bar input {\n        width: 50%;\n        padding: 15px;\n        padding-left: 10px;\n        border-radius: 5px;\n        border: 1px solid grey;\n    }\n\n    section.tp-search-bar button {\n\n        padding: 15px;\n        margin-left: 10px;\n        color: white;\n        background-color: rgb(133, 209, 18);\n        border: 1px solid grey;\n        border-radius: 5px;\n\n    }\n\n    section.tp-search-bar button:hover {\n        cursor: pointer;\n\n        background-color: rgb(104, 170, 4);\n    }\n\n    .ewvwp-modal {\n        position: fixed;\n        left: 0;\n        top: 0;\n        width: 100%;\n        height: 100%;\n        background-color: rgba(0, 0, 0, 0.5);\n        opacity: 0;\n        visibility: hidden;\n        transform: scale(1.1);\n        transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;\n    }\n\n    .ewvwp-modal-content {\n        position: absolute;\n        top: 50%;\n        left: 50%;\n        transform: translate(-50%, -50%);\n        background-color: white;\n        padding: 1rem 1.5rem;\n        width: 24rem;\n        border-radius: 0.5rem;\n    }\n\n    .ewvwp-close-button {\n        float: right;\n        width: 1.5rem;\n        line-height: 1.5rem;\n        text-align: center;\n        cursor: pointer;\n        border-radius: 0.25rem;\n        background-color: rgb(206, 235, 197);\n    }\n\n    .ewvwp-close-button:hover {\n        background-color: rgb(244, 247, 243);\n    }\n\n    .ewvwp-show-modal {\n        opacity: 1;\n        visibility: visible;\n        transform: scale(1.0);\n        transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;\n    }\n\n    .ewvwp-modal-content div {\n        display: flex;\n        flex-direction: column;\n        padding-top: 35px;\n        padding-bottom: 25px;\n\n    }\n\n\n    .ewvwp-modal-content div input {\n        width: 100%;\n        padding: 15px;\n        padding-left: 10px;\n        border-radius: 5px;\n        border: 1px solid grey;\n        margin-bottom: 10px;\n    }\n<\/style>\n\n\n<!--<section class=\"tp-search-bar\">\n        <input type=\"text\" placeholder=\"Search For a Participant...\">\n        <button>Search<\/button>\n    <\/section>-->\n\n<section class=\"tp-vote-container\">\n\n\n    \n\n\n        <div class=\"vote-item\">\n            <img loading=\"lazy\" decoding=\"async\" width=\"213\" height=\"237\" src=\"https:\/\/votekenya.co.ke\/wp-content\/uploads\/2025\/11\/coke.jpeg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" \/>            <span>Ben Ngigi<\/span>\n                            <span>State: <\/span>\n                                        <span>Votes: 0<\/span>\n                        <a class=\"ewvwp-trigger\" id=\"vote-10\" onclick=\"return easyWVWPMForm(10)\">Vote Now<\/a>\n        <\/div>\n\n\n\n    \n\n\n        <div class=\"vote-item\">\n            <img loading=\"lazy\" decoding=\"async\" width=\"225\" height=\"225\" src=\"https:\/\/votekenya.co.ke\/wp-content\/uploads\/2025\/11\/snack.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" srcset=\"https:\/\/votekenya.co.ke\/wp-content\/uploads\/2025\/11\/snack.jpg 225w, https:\/\/votekenya.co.ke\/wp-content\/uploads\/2025\/11\/snack-150x150.jpg 150w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/>            <span>Johnson Sakaya<\/span>\n                            <span>State: <\/span>\n                                        <span>Votes: 0<\/span>\n                        <a class=\"ewvwp-trigger\" id=\"vote-13\" onclick=\"return easyWVWPMForm(13)\">Vote Now<\/a>\n        <\/div>\n\n\n\n    <\/section>\n<div class=\"ewvwp-modal\">\n    <div class=\"ewvwp-modal-content\">\n        <span class=\"ewvwp-close-button\">&times;<\/span>\n        <div>\n            <form method=\"post\" action=\"#\" id=\"ewvwp-theme-2-form\" onsubmit=\"return easyWVWPMFormSubmit(event)\">\n                <input type=\"hidden\" name=\"vote-id\" value=\"\" id=\"vote-id\">\n                <input placeholder=\"Enter your Email\" id=\"ewvwp-email\" type=\"text\">\n                <input type=\"number\" id=\"ewvwp-number-of-vote\" onkeyup=\"return updateAmount(event)\" placeholder=\"Number of Votes\">\n                <input type=\"number\" id=\"ewvwp-amount-of-vote\" readonly placeholder=\"Amount\">\n                <input type=\"submit\" name=\"vote\" value=\"Vote\">\n            <\/form>\n        <\/div>\n    <\/div>\n<\/div>\n<script>\n    \/\/ MODAL BOX JS\n    var modal = document.querySelector(\".ewvwp-modal\");\n    var trigger = document.querySelector(\".ewvwp-trigger\");\n    var closeButton = document.querySelector(\".ewvwp-close-button\");\n    var numberOfVote = document.getElementById(\"ewvwp-number-of-vote\");\n\n    function toggleModal() {\n        modal.classList.toggle(\"ewvwp-show-modal\");\n    }\n\n    function windowOnClick(event) {\n        if (event.target === modal) {\n            toggleModal();\n        }\n    }\n\n    function easyWVWPMForm(id) {\n        toggleModal();\n        document.getElementById(\"vote-id\").value = id;\n    }\n\n\n    function easyWVWPMFormSubmit(event) {\n        event.preventDefault();\n        var id = document.getElementById(\"vote-id\").value;\n        var quantity = document.getElementById(\"ewvwp-number-of-vote\").value;\n        var amount = document.getElementById(\"ewvwp-amount-of-vote\").value;\n        var email = document.getElementById(\"ewvwp-email\").value;\n        var ajaxurl = \"https:\/\/votekenya.co.ke\/wp-admin\/admin-ajax.php\";\n\n        if (email == \"\" || quantity == \"\") {\n\n            alert(\"Fill the necessary details\");\n\n            return;\n        }\n\n        var handler = PaystackPop.setup({\n            key: 'pk_live_696fbc7310d587ef602cb4bcfabd3e6297f5f4e5', \/\/ Replace with your public key\n            email: email,\n            amount: amount * 100, \/\/ the amount value is multiplied by 100 to convert to the lowest currency unit\n            currency: 'KES', \/\/ Use GHS for Ghana Cedis or USD for US Dollars\n            reference: 'Easy Wp Voting With Payment', \/\/ Replace with a reference you generated\n            callback: function(response) {\n                \/\/this happens after the payment is completed successfully\n                var reference = response.reference;\n                console.log(reference);\n                jQuery.ajax({\n                    url: ajaxurl,\n                    type: 'post',\n                    dataType: 'json',\n                    data: {\n\n                        quantity: quantity,\n                        userID: id,\n                        reference: reference,\n                        email: email,\n                        action: 'ewvwp_form_ajax'\n\n                    },\n                    success: function(response) {\n\n                        if (response.success == true) {\n                            document.getElementById(\"ewvwp-theme-2-form\").reset();\n                            alert(response.message);\n                            setTimeout(window.location.reload(), 500);\n                        } else {\n                            \/\/console.log(response.message);\n                            alert(response.message);\n                        }\n                    }\n\n                });\n            },\n            onClose: function() {\n                alert('Transaction was not completed, window closed.');\n            },\n        });\n        handler.openIframe();\n    }\n\n    function updateAmount(event) {\n        var quantity = event.target.value;\n\n        var total = quantity * 10;\n        document.getElementById(\"ewvwp-amount-of-vote\").value = total;\n    }\n    \/\/trigger.addEventListener(\"click\", toggleModal);\n    closeButton.addEventListener(\"click\", toggleModal);\n    window.addEventListener(\"click\", windowOnClick);\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/pages\/2","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/comments?post=2"}],"version-history":[{"count":2,"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/pages\/2\/revisions"}],"predecessor-version":[{"id":9,"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/pages\/2\/revisions\/9"}],"wp:attachment":[{"href":"https:\/\/votekenya.co.ke\/index.php\/wp-json\/wp\/v2\/media?parent=2"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}