Problem with additional custom field in existing meta box
- This topic has 3 replies, 2 voices, and was last updated 6 years, 8 months ago by
Anh Tran.
-
AuthorPosts
-
August 20, 2018 at 5:11 PM #11068
lhkeeper
ParticipantHello,
I hope you will be able to help me on this. I created for my project a few meta boxes with a number of custom fields a few month ago. Today I wanted to extend one of them with addition custom field (url link). I added it to the code as I did it before but nothing has been displayed unfortunately. It looks like the new field is not "accepted". I am enclosing the code for your attention below.
I will appropriate any help on this matter.
Thanks!<?php // meta box for Homepage - Benefits Section $meta_boxes[] = [ 'title' => esc_html__( 'Benefits Section', 'lhk' ), 'post_types' => [ 'page', ], 'context' => 'after_title', 'priority' => 'default', 'autosave' => false, 'include' => [ 'relation' => 'AND', 'template' => [ 'templates/template-homepage.php', ], ], 'fields' => [ [ 'id' => 'benefits_h1', 'type' => 'text', 'name' => esc_html__('Heading Text', 'lhk'), 'desc' => esc_html__('Please insert your text in the box.','lhk'), 'size' => 85, ], [ 'id' => 'benefits_text', 'type' => 'textarea', 'name' => esc_html__('Description', 'lhk'), 'desc' => esc_html__('Please insert your text in the box.','lhk'), ], //***** This is a new custom field I wanted to add [ 'id' => 'benefits_button_heading', 'type' => 'text', 'name' => esc_html__('See more Features', 'lhk'), 'size' => 85, ], [ 'id' => 'benefits_button_url', 'type' => 'url', 'name' => esc_html__('Redirection URL', 'lhk'), 'desc' => esc_html__('Please insert URL address in the box','lhk'), 'size' => 85, ], //***** [ 'id' => 'group_benefits', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'collapsible' => true, 'add_button' => esc_html__( 'Add FlipBox', 'lhk' ), 'group_title' => esc_html__( 'Flip Box', 'lhk' ), // ID of the subfield 'save_state' => true, 'fields' => [ [ 'id' => 'benefits_image', 'type' => 'single_image', 'name' => esc_html__('Icon/Image', 'lhk'), 'desc' => esc_html__('Please upload your image.','lhk'), ], [ 'id' => 'benefits_front', 'type' => 'text', 'name' => esc_html__('Flipbox - Front', 'lhk'), 'desc' => esc_html__('Please insert your text in the box.','lhk'), 'size' => 85, ], [ 'id' => 'benefits_back', 'type' => 'text', 'name' => esc_html__('Flipbox - Back', 'lhk'), 'desc' => esc_html__('Please insert your text in the box.','lhk'), 'size' => 85, ], ], ], ], ];
August 23, 2018 at 3:09 PM #11099Anh Tran
KeymasterI see you're using Include Exclude extension. Can you check if these fields appear on that specific page template?
August 29, 2018 at 2:34 PM #11167lhkeeper
ParticipantHello Anh,
My apologies for delay in response. At the beginning they didn't appear on the page at all. I deleted and then uploaded my plugin few times in a row and then suddenly they showed up. So everything is working fine at the moment. However I'm wondering what could be the reason for this behavior...
Thank you,
KasiaSeptember 1, 2018 at 2:28 PM #11211Anh Tran
KeymasterHi Kasia,
Glad that the problem is resolved.
I'm not sure about the bug, neither. Maybe it's some kind of caching / proxy. Some browsers (like Firefox) auto caches the page. So, next time, try to clear the browser cache first.
I'll mark this topic as resolved. If you need any help, please just reply.
-
AuthorPosts
- You must be logged in to reply to this topic.