'Wordpress - Broken UI of CMB2/cmb2-attached-posts library
I have implemented the CMB2/cmb2-attached-post library in my wordpress installation and created a custom post type in which to use it. I have implemented the example described in the example-field-setup-php, specifically, in this way:
$example_meta = new_cmb2_box( array(
'id' => 'cmb2_attached_posts_field',
'title' => __( 'Attached Posts', 'yourtextdomain' ),
'object_types' => array( 'luogo' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
) );
$example_meta->add_field( array(
'name' => __( 'Attached Posts', 'yourtextdomain' ),
'desc' => __( 'Drag ...', 'yourtextdomain' ),
'id' => 'attached_cmb2_attached_posts',
'type' => 'custom_attached_posts',
'column' => true,
'options' => array(
'show_thumbnails' => true,
'filter_boxes' => true,
'query_args' => array(
'posts_per_page' => 10,
'post_type' => 'page',
),
),
) );
$example_meta->add_field( array(
'name' => __( 'Attached Users', 'yourtextdomain' ),
'desc' => __( 'Drag ...', 'yourtextdomain' ),
'id' => 'attached_cmb2_attached_users',
'type' => 'custom_attached_posts',
'column' => true,
'options' => array(
'show_thumbnails' => true,
'filter_boxes' => true,
'query_users' => true,
),
) );
The result I get graphically is this:
Which is visibly broken and malfunctioning. What I got as a result is the following: (as shown on the library repo).
Why do I get a broken result if the library has been integrated as per the documentation? Is something missing?
What I have done for use is: Installing the library with composer and the inclusion of the library in the .php file where I create the custom post type:
require_once ( get_template_directory() . /vendor/webdevstudios/cmb2-attached-posts/init.php' );
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


