- This topic has 5 replies, 3 voices, and was last updated 7 years, 8 months ago by
Steve.
-
AuthorPosts
-
-
May 13, 2014 at 3:56 pm #1716
achowellMemberI was creating a date picker field and was wanting to know how the scope is tied to the specific taxonomy I created? Does piklist determine this based on the taxonomy created in the plugin?
// Date Picker for Deadline piklist('field', array( 'type' => 'datepicker' ,'scope' => 'taxonomy' ,'field' => 'date_needed' ,'label' => 'Date Needed' ,'description' => 'Click in box' ,'required' => true ,'attributes' => array( 'class' => 'text' ) ,'options' => array( 'dateFormat' => 'M d, yy' ,'firstDay' => '0' ) ));I created a taxonomy called deadline how do I save under that?
-
May 13, 2014 at 8:45 pm #1717
SteveKeymaster@achowell– From our user guide:
For most situations you do not have to define “scope”. Piklist will do it automatically for you.
Piklist allows you to mix-and-match field types within a form. So, one form can have fields that save information as post_meta, while other fields save to a taxonomy. Scope is what determines where the field data is saved. If you don’t set the scope parameter then it will default to where the field is used. For example, if you are creating a metabox, then scope will automatically be set to post_meta.
-
May 14, 2014 at 11:34 am #1722
r.cespaMemberI have a similar problem: I need to save some data in a taxonomy term but I do not know how to specify what taxonomy should be used.
I noticed that naming the field like the taxonomy, the term is saved in wp_terms table but the relationship between taxonomy term and post is not saved anywhere.
Any hint on this? -
May 14, 2014 at 7:43 pm #1724
SteveKeymaster@r.cespa– Are you trying to save a taxonomy from the edit posts screens, or the edit taxonomy screen? Do you have any code you can post?
-
May 19, 2014 at 10:39 am #1731
r.cespaMember@Steve
Sorry for the delay: I created the CPT and the custom taxonomy using piklist; I’m trying to save data from CPT edit screen into the custom taxonomy.
<?php include('piklist-field-addons.php'); add_filter('piklist_post_types', 'WPT_post_type'); add_filter('piklist_taxonomies', 'WPT_type_tax'); function WPT_post_type($post_types) { $post_types['offer'] = array( 'labels' => piklist('post_type_labels', 'Offerta'), 'public' => true, 'rewrite' => array( 'slug' => 'offerta' ), 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'revisions' ), 'hide_meta_box' => array( 'author', 'revisions', 'comments', 'commentstatus' ) ); return $post_types; } function WPT_type_tax($taxonomies) { $taxonomies[] = array( 'post_type' => 'offer', 'name' => 'departureCity', 'show_admin_column' => true, 'hide_meta_box' => false, 'configuration' => array( 'hierarchical' => false, 'labels' => piklist('taxonomy_labels', 'Aeroporto di Partenza'), 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'aeroporto-di-partenza' ) ) ); return $taxonomies; }And in parts/meta-boxes/test.php I put:
piklist('field', array( 'type' => 'group', 'label' => 'Prezzi', 'field' => 'prezzi', // 'add_more' => true, 'fields' => array ( array( 'type' => 'datepicker', 'field' => 'departureDate', 'label' => 'Data di partenza', 'columns' => 6, ), array( 'columns' => 6, 'scope' => 'taxonomy', 'type' => 'text', 'field' => 'departureCity', 'label' => 'Città di partenza', 'description' => 'Terms will appear when they are added to this taxonomy.', ) ) ) );I can see the taxonomy meta-box on the edit screen and I can see the text field created by Piklist; if I put some text in that field, the term is saved to the database but it is not showed on the next refresh of the screen and is not added as a term in the “standard” meta-box. I tried saving draft, publishing, etc.
Any suggestion?
-
May 20, 2014 at 10:22 am #1734
SteveKeymaster@r.cespa– Piklist doesn’t create the default taxonomy meta boxes that WordPress has, so this might not work the way you want. Right now converted existing terms to a checkbox or radio button list is the way to go.
-
-
AuthorPosts
- You must be logged in to reply to this topic.