• Resolved andreadelgrosso

    (@andreadelgrosso)


    Hello, I have a problem with CMB2 in a taxomony.

    Here is the code:

    $cmb_demo = new_cmb2_box( array(
     'id'            => $prefix . 'sp_products_img_metabox',
     'title'         => __( 'Immagini prodotto', 'cmb2' ),
     'object_types'  => array( 'prodotto' ), // Post type
     'context'       => 'side',
     'priority'      => 'low',
     'show_names'    => true, // Show field names on the left
     // 'cmb_styles' => false, // false to disable the CMB stylesheet
     // 'closed'     => true, // true to keep the metabox closed by default
     ) );
    
        $cmb_demo->add_field( array(
     'name' => __( 'Thumbnail/Immagine principale', 'cmb2' ),
     'desc' => __( 'Carica l\'immagine principale del prodotto, verrà visualizzata più grande rispetto alle altre scelte sotto.', 'cmb2' ),
     'id'   => $prefix . 'prod_thumb',
     'type' => 'file',
     ) );

    I can show image in a taxonomy call “categoria-prodotto”?
    The custom post type name is “prodotto”.

    Someone can help me?

    https://ww.wp.xz.cn/plugins/cmb2/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m sorry, I’m having trouble understanding what the issue at hand is. Could you provide some more detail about what you’re trying to do and where it’s not working as expected?

    Thread Starter andreadelgrosso

    (@andreadelgrosso)

    Ok, I’m sorry!
    I used CMB2 in my website. In particular I create a custom post type call “prodotto”, and in it, I use a metabox image. Here is the code:

    $cmb_demo = new_cmb2_box( array(
     'id'            => $prefix . 'sp_products_img_metabox',
     'title'         => __( 'Immagini prodotto', 'cmb2' ),
     'object_types'  => array( 'prodotto' ), // Post type
     'context'       => 'side',
     'priority'      => 'low',
     'show_names'    => true, // Show field names on the left
     // 'cmb_styles' => false, // false to disable the CMB stylesheet
     // 'closed'     => true, // true to keep the metabox closed by default
     ) );
    
        $cmb_demo->add_field( array(
     'name' => __( 'Thumbnail/Immagine principale', 'cmb2' ),
     'desc' => __( 'Carica l\'immagine principale del prodotto, verrà visualizzata più grande rispetto alle altre scelte sotto.', 'cmb2' ),
     'id'   => $prefix . 'prod_thumb',
     'type' => 'file',
     ) );

    The result is wounderful and I succeed in it.
    But if I want to display the same image in a taxonomy too, I can not do.
    How is possible do?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    So you’re wanting a metabox for the term editor screen for terms in your taxonomy? Essentially a featured image for terms.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ever find a solution for this andreadelgrosso ?

    Thread Starter andreadelgrosso

    (@andreadelgrosso)

    Sorry for the delay. Unfortunately I have not found a solution for this and I worked it in a different way to solve.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    No worries, we’re happy you found a solution that works, which is the important part.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘CMB in taxonomy’ is closed to new replies.