Callback Function on CMB2
-
Hello, I am Brazilian and not dominate the English, I apologize for the bad writing. I have a function with arrays that use the Redux Framework, see below.
function my_get_sidebar_layouts( $inherit = false) { $layouts = array(); if ( $inherit ) { $layouts['inherit'] = array( 'title' => __( 'Inherit', THEME_SLUG ), 'img' => IMG_URI . '/images/inherit.png' ); } $layouts['none'] = array( 'title' => __( 'No sidebar (full width)', THEME_SLUG ), 'img' => IMG_URI . '/images/none.png', 'images_path' => get_template_directory_uri(),); $layouts['left'] = array( 'title' => __( 'Left sidebar', THEME_SLUG ), 'img' => IMG_URI . '/images/left.png' ); $layouts['right'] = array( 'title' => __( 'Right sidebar', THEME_SLUG ), 'img' => IMG_URI . '/images/right.png' ); return $layouts; }I use this way in redux:
array( 'id' => 'archive_sidebar', 'type' => 'image_select', 'title' => __( 'Sidebar layout', THEME_SLUG ), 'subtitle' => __( 'Choose sidebar layout for archive templates', THEME_SLUG ), 'options' => ny_get_sidebar_layouts(), 'default' => 'right' ),it works perfect…
A few days ago I’m trying to use it the same way in CMB2 with CMB2-radio-image-master. But I can not. Only the value goes, but the image and the title does not. can anybody help me?How do I use this function in CMB2 fields in the same way that I use in Redux?
$cmb_demo->add_field( array( 'name' => __( 'Test Radio Image', 'cmb2' ), 'desc' => __( 'field description (optional)', 'cmb2' ), 'id' => $prefix . 'radioimg', 'type' => 'radio_image', 'options' => array( 'full-width' => __('Full Width', 'cmb2'), 'sidebar-left' => __('Left Sidebar', 'cmb2'), 'sidebar-right' => __('Right Sidebar', 'cmb2'), ), 'images_path' => get_template_directory_uri(), 'images' => array( 'full-width' => 'images/content_no_sid.png', 'sidebar-left' => 'images/content_sid_left.png', 'sidebar-right' => 'images/content_sid_right.png', ) ) );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Callback Function on CMB2’ is closed to new replies.