<?php /* Extend: submitdiv Extend Method: replace Context: side Priority: core */ // Code based on wp-admin/includes/meta-boxes.php global $post, $action, $wp_post_statuses, $pagenow; $post_type = $post->post_type; $post_type_object = get_post_type_object($post_type); $can_publish = current_user_can($post_type_object->cap->publish_posts); $statuses = piklist_cpt::get_post_statuses_for_type(); foreach ($statuses as $status => &$configuration) { $configuration = (object) $configuration; } $statuses = isset($statuses) && !empty($statuses) ? $statuses : $wp_post_statuses; $initial_status = array('status' => current(array_keys($statuses)), 'data' => current($statuses)); $action_label = !isset($statuses['publish']) ? __('Save', 'piklist') : (isset($statuses['publish']->action) ? $statuses['publish']->action : __('Publish', 'piklist')); $status_type = $post->post_status == 'auto-draft' ? $initial_status['status'] : $post->post_status; ?> <div class="submitbox" id="submitpost"> <div id="minor-publishing" <?php echo apply_filters('hide_minor_publishing_submit_box', false) ? 'class="hide-all"' : null; ?> > <!-- Hide submit button early on so that the browser chooses the right button when form is submitted with Return key -->
* If your form is in a THEME (i.e. wp-content/themes/my-theme/piklist/parts/forms/my-form.php) * Use [piklist_form form="my-form" add_on="theme"] */ /** * The shortcode for this form is: * [piklist_form form="new-post-with-validation" add_on="piklist-demos"] */ /** * The fields in this form are exactly like the fields in piklist-demos/parts/meta-boxes/field-validate.php * Only the 'scope' paramater needed to be added. */ // Where to save this form piklist('field', array('type' => 'hidden', 'scope' => 'post', 'field' => 'post_type', 'value' => 'piklist_demo')); piklist('field', array('type' => 'text', 'scope' => 'post', 'field' => 'post_title', 'label' => __('Title', 'piklist-demo'), 'attributes' => array('wrapper_class' => 'post_title', 'style' => 'width: 100%'))); // Allows user to choose their own post status. $statuses = piklist_cpt::get_post_statuses_for_type('piklist_demo', false); piklist('field', array('type' => 'select', 'scope' => 'post', 'field' => 'post_status', 'label' => __('Post Status', 'piklist-demo'), 'choices' => $statuses, 'attributes' => array('wrapper_class' => 'post_status'))); /** * To automatically set the post status: *** Remove the field above since it's letting the user choose their status *** Uncomment this field *** Set your default post status by changing the "value" parameter. */ // piklist('field', array( // 'type' => 'hidden' // ,'scope' => 'post' // ,'field' => 'post_status' // ,'value' => 'pending' // )); // piklist('field', array('type' => 'text', 'scope' => 'post_meta', 'field' => 'validate_text_required', 'label' => __('Text Required', 'piklist-demo'), 'description' => "required => true", 'attributes' => array('wrapper_class' => 'validate_text_required', 'placeholder' => __('Enter text or this page won\'t save.', 'piklist-demo')), 'required' => true, 'validate' => array(array('type' => 'limit', 'options' => array('min' => 2, 'max' => 6, 'count' => 'characters')))));
?> <?php foreach ($post_types as $post_type) { ?> <?php $status_count = 0; ?> <?php $num_pages = wp_count_posts($post_type->name); ?> <?php $statuses = piklist_cpt::get_post_statuses_for_type($post_type->name); ?> <?php foreach ($statuses as $status => $value) { ?> <?php if ($value->public == 1) { ?> <?php $status_count = $status_count + $num_pages->{$status}; ?> <?php