function wpp_promotion_profile() { if (wpp_is_promoter()) { wpp_get_template_part('promotion-profile'); } else { wpp_get_template_part('signup'); } }
function wpp_view_promotion() { if (wpp_is_promoter()) { wpp_get_template_part('view-promotion'); } else { wpp_get_template_part('signup'); } }
function wpp_submit_promotion() { if (wpp_is_promoter()) { //shortcode functions if (isset($_POST['promotion_nonce_field']) && wp_verify_nonce($_POST['promotion_nonce_field'], 'promotion_nonce')) { $success = wpp_submit_save_promotion($_POST['postTitle'], $_POST['postContent'], $_POST['category'], $_POST['attach_id'], $_POST['promoStart'], $_POST['promoEnd'], $_POST['promotion_nonce_field']); } wpp_get_template_part('submit-promotion'); } else { wpp_get_template_part('signup'); } }
function wpp_edit_promotion() { if (wpp_is_promoter()) { //make sure GET is set, no post id == no post to edit, also check to see if user is logged in if (isset($_GET['post']) && wpp_is_promoter()) { //save before we grab data (it could have already been updated!) if (isset($_POST['promotion_nonce_field']) && wp_verify_nonce($_POST['promotion_nonce_field'], 'promotion_nonce')) { $success = wpp_edit_save_promotion($_GET['post'], $_POST['postTitle'], $_POST['postContent'], $_POST['category'], $_POST['attach_id'], $_POST['promoStart'], $_POST['promoEnd'], $_GET['post'], $_POST['promotion_nonce_field']); } } wpp_get_template_part('edit-promotion'); } else { wpp_get_template_part('signup'); } }
<div class="promotions promotions-container"> <?php wpp_get_template_part('parts/menu'); ?> <?php if (isset($_POST['submitted'])) { if (isset($_POST['postTitle']) && isset($_POST['postContent']) && !empty($_POST['postTitle']) && !empty($_POST['postContent'])) { ?> <div class="promotion-success"> <?php _e('Congratulations your promotion has been successfully added!', 'wpp'); ?> <br /> <?php _e('Please add another promotion!', 'wpp'); ?> </div> <?php } else { ?> <div class="promotion-warning"> <?php _e('Woops your promotion was missing a title or description!', 'wpp'); ?> <br /> <?php
<div class="promotions promotions-container"> <?php wpp_get_template_part('parts/menu'); ?> <ul class="promotions-list"> <?php $author_id = get_current_user_id(); $query = new WP_Query(array('post_type' => 'promotion', 'posts_per_page' => '-1', 'post_status' => array('publish', 'pending'), 'author' => $author_id)); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); wpp_get_template_part('parts/single-promotion'); } } else { ?> <div class="promotion-info"><?php _e('No promotions found! Please add some!', 'wpp'); ?> </div> <?php } ?> </ul> </div>
function wpp_menu() { wpp_get_template_part('main-menu'); }