- This topic has 1 reply, 2 voices, and was last updated 3 years ago by
Steve.
-
AuthorPosts
-
-
January 23, 2019 at 4:06 am #9299
dewebkillerParticipantI have a front-end form in piklist for the users to submit the post. All I want is to organize the post sent from the user in single category that i created in the back-end. I cannot see to set the default value in the piklist form.
My submit-post :
<?php
/*
Title: Post Submit
Method: post
Message: Post Saved
Logged in: true
*/// Where to save this form
$choices = piklist(
get_terms(‘category’, array(
‘hide_empty’ => false,
))
,array(
‘term_id’
,’name’
));
$choices[-1] = ‘All Categories’;
ksort($choices);piklist(‘field’, array(
‘type’ => ‘hidden’
, ‘scope’ => ‘post’
, ‘field’ => ‘post_type’
, ‘value’ => ‘post’
));piklist(‘field’, array(
‘type’ => ‘text’
, ‘scope’ => ‘post’
, ‘field’ => ‘post_title’
, ‘label’ => __(‘Title’, ‘piklist’)
,’reset’ => ‘true’
,’attributes’ => array(
‘wrapper_class’ => ‘post_title’
, ‘style’ => ‘width: 100%’
)
));piklist(‘field’, array(
‘type’ => ‘editor’
, ‘scope’ => ‘post’, ‘field’ => ‘post_content’
, ‘label’ => __(‘Content’, ‘piklist’)
, ‘attributes’ => array(
‘wrapper_class’ => ‘post_content’
, ‘style’ => ‘width: 100%’
)
));piklist(‘field’, array(
‘type’ => ‘file’
,’field’ => ‘_thumbnail_id’
,’scope’ => ‘post_meta’
,’preview_size’ => ‘medium’
,’label’ => ‘Media Uploader’
,’options’ => array(
‘modal_title’ => ‘Add File(s)’
,’button’ => ‘Add’
)
));piklist(‘field’, array(
‘type’ => ‘select’
,’scope’ => ‘taxonomy’
,’field’ => ‘category’
,’label’ => ‘Categories’
//,’description’ => ‘Terms will appear when they are added to this taxonomy.’
,’choices’ => array(
” => ‘Choose Term’
)
+ piklist(get_terms(array(
‘taxonomy’ => ‘category’
,’hide_empty’ => true
))
,array(
‘term_id’
,’name’
)
)
));piklist(‘field’, array(
‘type’ => ‘hidden’
, ‘scope’ => ‘post’
, ‘field’ => ‘post_status’
, ‘value’ => ‘pending’
));// Submit button
piklist(‘field’, array(
‘type’ => ‘submit’
, ‘field’ => ‘submit’
, ‘value’ => ‘Submit’
,’reset’ => ‘true’
)); -
January 25, 2019 at 1:06 pm #9306
SteveKeymasterYou can use the
valueparamater to set the default. Set it to the KEY of the value you want.
-
-
AuthorPosts
- You must be logged in to reply to this topic.