plugins - CMB2 Output Select Box Chosen Option

I have the following code for a metabox which allows the user to select a post category but I cant seem to ouput the cho

I have the following code for a metabox which allows the user to select a post category but I cant seem to ouput the chosen option on the front end. Any ideas ?

Heres what I have so far :

// Choose Category For Posts
    $cmb->add_field( array(
        'name'    => esc_html__( 'Category', 'majestica' ),
        'desc'    => esc_html__( 'Category of Posts to Display. If using one of the templates that displays a number of posts.', 'majestica' ),
        'id'      => 'majestica_posts_category',
        'taxonomy'       => 'category', //Enter Taxonomy Slug
        'type'           => 'taxonomy_select',
    ) );

And on the front end :

$categoryname = get_post_meta( get_the_ID(), 'majestica_posts_category', true );
echo $categoryname;

It doesnt display anything, I simply want it to echo out the chosen category.

Please help.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745558100a4632940.html

相关推荐

  • plugins - CMB2 Output Select Box Chosen Option

    I have the following code for a metabox which allows the user to select a post category but I cant seem to ouput the cho

    7小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信