Forum Replies Created
-
AuthorPosts
-
August 29, 2018 at 2:34 PM in reply to: โ Problem with additional custom field in existing meta box #11167
lhkeeper
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,
Kasialhkeeper
ParticipantHi Anh,
I hope you had a good weekend. Thank you for all your help and concern. I checked everything once again and.... instead of returning each meta box (code) in each file I assigned it to meta boxes array..so in the end, I was trying to nest a meta boxes array in meta boxes array ๐ I am not sure if I explain it clearly enough ๐ Long story short, my each file started like this:
$meta_boxes[] = [
'title' => esc_html__( 'Service Testimonials', 'lhk' ),
'post_types' => [
'page',
],.....
etc......and should like this:
return[
'title' => esc_html__( 'Service Testimonials', 'lhk' ),
'post_types' => [
'page',
],......
etc.......
It caused all these errors.Thank you again Anh
Best,
Kasialhkeeper
ParticipantAs an example I am giving you the code for a one meta box I created. If you wish to see all files please let me know.
All the meta boxes are created in this way:
lhkeeper
ParticipantAhn, I am just wondering... If I registered some fields e.g. email filed this way:
[
'id' => 'contact_email',
'type' => 'email',
'name' => esc_html__( 'Email:', 'lhk' ),
'desc' => esc_html__( 'Please insert your email here.', 'lhk' ),
'size' => 50,
],where 'type' is 'email' instead of e.g. 'text' could it caused the problem?
I have a few fields registered as 'type' => 'url' .... when I checked the documentation there are no these types of fields...lhkeeper
ParticipantBy the way I am using TGM Activation Class to include your plugins, if it can help anyhow...
lhkeeper
ParticipantHi Anh ๐
There you go:
/** * Displaying all custom metaboxes */ add_filter( 'rwmb_meta_boxes', 'lhk_register_home_meta_boxes' ); function lhk_register_home_meta_boxes( $meta_boxes ) { $files_contact = glob( get_template_directory() .'/inc/contact-mod/<em>.php' ); $files_csi = glob( get_template_directory() .'/inc/csi-mod/</em>.php' ); $files_general = glob( get_template_directory() .'/inc/general-mod/<em>.php' ); $files_home = glob( get_template_directory() .'/inc/home-mod/</em>.php' ); $files_how = glob( get_template_directory() .'/inc/how-mod/<em>.php' ); $files_prod = glob( get_template_directory() .'/inc/product-mod/</em>.php' ); $files_post = glob( get_template_directory() .'/inc/post-mod/<em>.php' ); $files_testimonials = glob( get_template_directory() .'/inc/testimonials-mod/</em>.php' ); $all_files = [ $files_contact, $files_csi, $files_general , $files_home, $files_how , $files_prod , $files_post, $files_testimonials ]; foreach ( $all_files as $key => $files ) { foreach( $files as $file ){ $meta_boxes[] = include $file; } } return $meta_boxes; }Thank you ๐
lhkeeper
Participantah also those two lines in the end I have:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\wordpress\wp-content\plugins\meta-box\inc\meta-box.php:369) in C:\xampp\htdocs\wordpress\wp-content\plugins\unyson\framework\includes\hooks.php on line 256
Warning: array_unique() expects parameter 1 to be array, null given in C:\xampp\htdocs\wordpress\wp-includes\post-template.php on line 772Warning: join(): Invalid arguments passed in C:\xampp\htdocs\wordpress\wp-includes\post-template.php on line 557
class="">lhkeeper
ParticipantThank you very much Anh.
Have a great day!
Kasialhkeeper
ParticipantHi Anh,
Please look at my code below:
I'm using "url" type field as the videos will be stored in the other place.
Thank you -
AuthorPosts