Display the Metadata question
-
I followed the instructions from github.
If including the library in your plugin or theme:
-
Place the CMB2 directory inside of your theme or plugin.
Copy the entirety of its contents to your theme’s functions.php file.
Edit to only include the fields you need and rename the functions (CMB2 directory should be left unedited in order to easily update the library).
Profit.I’m trying to use the multiple files for images.
$cmb_demo->add_field( array( 'name' => __( 'Multiple Files', 'cmb2' ), 'desc' => __( 'Upload or add multiple images/attachments.', 'cmb2' ), 'id' => $prefix . 'file_list', 'type' => 'file_list', 'preview_size' => array( 100, 100 ), // Default: array( 50, 50 ) ) );I’ve set
'object_types' => array( 'mycustomposttype', ), // Post typeand it works. All the fields show in admin and I add few images.In my
content-mycustomposttype.phpfor displaying the metadata.<?php // Grab the metadata from the database $file_list = get_post_meta( get_the_ID(), '_yourprefix_file_list', true ); // Echo the metadata echo esc_html( $file_list); ?>But when I save the post and visit the page nothing shows up.
What am I missing?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Display the Metadata question’ is closed to new replies.