Created
April 6, 2019 06:58
-
-
Save vineettalwar/855a93b45b16163b31bb54af0a2b8dc3 to your computer and use it in GitHub Desktop.
ob submit action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Title: Grouped Post | |
Method: post | |
Message: Grouped Post Created | |
Logged in: true | |
*/ | |
piklist( 'field', array( | |
'type' => 'hidden' | |
,'scope' => 'post' | |
,'field' => 'post_type' | |
,'value' => 'grouped' | |
) | |
); | |
piklist('field', array( | |
'type' => 'text' | |
,'field' => 'post_title' | |
,'scope' => 'post' | |
,'required' => true | |
,'label' => esc_html__('Title','dummytheme') | |
,'attributes' => array( | |
'wrapper_class' => 'post_title' | |
,'class' => 'regular-text form-control' | |
) | |
)); | |
$cover = ''; | |
if( isset($_GET['_post']) && isset($_GET['_post']['ID']) ) { | |
$post_id = $_GET['_post']['ID']; | |
$cover = ff_get_post_thumbnail( $post_id ); | |
} | |
piklist('field', array( | |
'type' => 'text' | |
,'field' => 'cover' | |
,'scope' => 'post_meta' | |
,'label' => esc_html__('Cover Image','dummytheme') | |
,'value' => $cover | |
,'attributes' => array( | |
'class' => 'regular-text input-upload-file upload-image form-control dashicons-camera' | |
) | |
)); | |
piklist('field', array( | |
'type' => 'hidden' | |
,'scope' => 'post_meta' | |
,'field' => '_thumbnail_id' | |
,'required' => true | |
,'label' => esc_html__('Thumbnail ID','dummytheme') | |
,'attributes' => array( | |
'class' => 'hide input-upload-file-id' | |
) | |
)); | |
piklist('field', array( | |
'type' => 'select' | |
,'field' => 'group_type' | |
,'scope' => 'taxonomy' | |
,'label' => esc_html__('Type','dummytheme') | |
,'choices' => piklist(get_terms('group_type', array( | |
'hide_empty' => false, | |
)), array( | |
'term_id', | |
'name', | |
) | |
) | |
,'attributes' => array( | |
'class' => 'regular-text form-control' | |
// ,'multiple' => 'multiple' // Allow a select field to accept multiple selections | |
) | |
)); | |
piklist( 'field', array( | |
'type' => 'text' | |
,'scope' => 'post_meta' | |
,'required' => true | |
,'label' => esc_html__('post Ids','dummytheme') | |
,'field' => 'post_ids_key' | |
,'attributes' => array( | |
'class' => 'regular-text form-control input-upload-file-id' | |
) | |
)); | |
piklist('field', array( | |
'type' => 'hidden' | |
,'scope' => 'post' | |
,'field' => 'post_status' | |
,'value' => 'pending' | |
)); | |
// Submit button | |
piklist('field', array( | |
'type' => 'submit' | |
,'field' => 'submit' | |
,'value' => esc_html__('Submit','dummytheme') | |
,'attributes' => array( | |
'class' => 'btn primary text-white' | |
))); | |
function on_submit_query($term_id) { | |
$taxonomy = 'group_type'; | |
$args = array( | |
'post_type' => 'post', | |
'post_status' => 'publish', | |
'posts_per_page' => '-1', | |
'tax_query' => array( | |
'relation' => 'AND', | |
array( | |
'taxonomy' => $taxonomy, | |
'field' => 'term_id', | |
'terms' => $term_id, | |
), | |
), | |
); | |
$query = new WP_Query($args); | |
$posts = $query->posts; | |
$post_id_array = wp_list_pluck($query->posts, 'ID'); | |
return ($post_id_array); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment