Custom Fields
Re-Envisioned
Support General Invalid argument supplied… Reply To: Invalid argument supplied…

#9279

lhkeeper
Participant

Hi 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 🙂