- This topic has 6 replies, 3 voices, and was last updated 5 years, 5 months ago by
Steve.
-
AuthorPosts
-
-
August 12, 2016 at 5:28 am #7144
titidodoParticipantHey everybody,
i want to add three metaboxes to add content for a specific page.
Here’s what i did:
– installed piklist
– added this folders to my theme: piklist/parts/meta-boxes
– created three php files insideHere is an example of how the php files look like:
<?php /* Title: Solution Panel Box 1 Post Type: page id: 5 collapse: true order: 10 */ piklist('field', array( 'type' => 'text' , 'field' => 'home_solution1_title' , 'label' => 'Title' , 'columns' => 12 )); piklist('field', array( 'type' => 'file' , 'field' => 'home_solution1_icon' , 'label' => 'Icon' , 'options' => array( 'modal_title' => __('Add File(s)', 'piklist-demo') , 'button' => __('Add', 'piklist-demo') ) )); piklist('field', array( 'type' => 'file' , 'field' => 'home_solution1_image' , 'label' => 'Image' , 'options' => array( 'modal_title' => __('Add File(s)', 'piklist-demo') , 'button' => __('Add', 'piklist-demo') ) )); piklist('field', array( 'type' => 'group' , 'field' => 'home_solution1_checklist' , 'label' => 'Checklist' , 'columns' => 12 , 'add_more' => true , 'fields' => array( array( 'type' => 'text' , 'field' => 'home_solution1_checklist_title' , 'label' => 'Title' , 'columns' => 12 ) , array( 'type' => 'editor' , 'field' => 'home_solution1_checklist_centent' , 'label' => 'Content' , 'columns' => 12 , 'options' => array( 'wpautop' => true , 'media_buttons' => false , 'teeny' => true , 'dfw' => false , 'textarea_rows' => 2 ) ) , array( 'type' => 'text' , 'field' => 'home_solution1_checklist_morelink' , 'label' => 'Link' , 'columns' => 12 ) ) ));The only changes i made in the other files is to change the ‘field’ key.
-> All three metaboxes appear as desired when editing the page with the ID 5
-> Problem: I inserted some data, saved and it worked out the first time. But all changes i make now won’t save.Thanks in advance for your help!!
-
August 12, 2016 at 5:12 pm #7149
SteveKeymasterDo you see any errors with WP_DEBUG turned on? How about Chrome console?
-
August 13, 2016 at 3:29 am #7151
titidodoParticipantHey Steve! No errors with WP_DEBUG turned on and also no errors in Chrome console. 🙁
If i fill the metaboxes with data and click the save button, it writes it to the database as shown in the attachment.
“home_solution1_title” is filled with the value of the first save, values in the other fields won’t save.Attachments:
You must be logged in to view attached files. -
August 15, 2016 at 3:04 am #7163
IcoMemberHi,
I have just the same problem, only on meta fields added to some, but not all custom page templates.
-
August 15, 2016 at 7:44 am #7164
titidodoParticipantI added this code to my functions.php
function post_type_support_init() { remove_post_type_support('post', 'custom-fields'); remove_post_type_support('page', 'custom-fields'); } add_action('init', 'post_type_support_init');Now the values are updating correctly! 🙂
-
August 17, 2016 at 4:22 pm #7177
-
-
AuthorPosts
- You must be logged in to reply to this topic.