Tagged: groups
- This topic has 7 replies, 2 voices, and was last updated 7 years, 3 months ago by
Steve.
-
AuthorPosts
-
-
November 4, 2014 at 7:05 am #2642
atanasMemberHi,
Is there a way to implement custom save/load functions if we do not want to use the default saving to metadata?
Or is there a general setting to have all the fields on the custom post save in a single postmeta record, without grouping the fields, as they are in separate files?
Thanks
Atanas -
November 4, 2014 at 12:06 pm #2649
SteveKeymaster@atanas– Piklist uses core WordPress functions, and saving post meta is usually one value per record. If you want to save a group of field data in one array, use the Piklist
groupfield. You can see a sample of this in the built-in Demos:
Add New Demo > Groups tab > Address (Grouped).Let me know if that helps.
-
November 4, 2014 at 1:03 pm #2651
atanasMemberThanks Dteve,
Tried to put them in a group with all sort of issues came with sub grouos in the group – the fields and labels are mis-aligned. I will post the code on the othe thread, as it shows the issue with both the conditions and mis alignment, or do you want me to post here?
Thanks
Atanas -
November 4, 2014 at 1:47 pm #2654
atanasMemberHi Steve,
I posted the sample code in the other thread, I am attaching here two screen shots – how the fields should look (the shipping field needs to be outside of the add more), and how they look if they are all bundled together in one group so the data is saved in one postmeta.
Thanks,
AtanasAttachments:
You must be logged in to view attached files. -
November 4, 2014 at 2:07 pm #2657
atanasMemberHi Steve,
Just in case, here is also the code when the shipping is ungrouped and saves in a separate postmeta, if it can also help nail down the issues
piklist('field', array('type' => 'group', 'label' => 'Fruits', 'add_more' => true, 'description' => 'Select a fruit.', 'fields' => array( array( 'type' => 'select', 'field' => 'country', 'label' => 'Country', 'value' => 'US', 'columns' => 4, 'choices' => array( 'US' => 'United States', 'EU' => 'European Union' ) ), array( 'type' => 'select', 'field' => 'fruits', 'label' => 'Fruits', 'value' => 'apples', 'columns' => 12, 'choices' => array( "apples" => "Apples", "oranges" => "Oranges", ) ), array( 'type' => 'select', 'field' => 'apples', 'label' => 'Apples', 'columns' => 12, 'value' => 'post_title', 'choices' => array( "aceymac" => 'Aceymac apple', "akero" => 'Akero apple', ), 'conditions' => array( array( "reset" => false, 'field' => 'fruits', 'value' => "apples" ), )), array( 'type' => 'select', 'field' => 'oranges', 'label' => 'Oranges', 'columns' => 12, 'choices' => array( "blood" => "Blood Orange", "navel" => "Navel Orange" ), 'conditions' => array( array( "reset" => false, 'field' => 'fruits', 'value' => "oranges" ), )), ), ) ); piklist('field', array( 'type' => 'select', 'field' => 'shipping', 'label' => 'Shipping', 'columns' => 4, 'choices' => array( '' => '', 'ground' => 'Ground', 'UPS' => 'UPS', ) ) ); -
November 5, 2014 at 12:14 pm #2659
-
November 5, 2014 at 1:54 pm #2660
atanasMemberHi steve,
Originally I asked about a custom save/load since sub groups do not work. You suggested I use a group to have all the data saved in a single record, and that is why I posted the code to help you see the issues. Either of the solutions (custom save/load put all fields in a master group) would be ok, even though with too many fields it will be a burden to have them in a single file i order to use a mater group.
Thanks
Atanas -
November 6, 2014 at 1:51 pm #2664
SteveKeymasterClosing this ticket since we are working on the issue here >
-
-
AuthorPosts
- The topic ‘Custom save/load’ is closed to new replies.