admin管理员组文章数量:1431420
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.
本文标签: pluginsCMB2 Output Select Box Chosen Option
版权声明:本文标题:plugins - CMB2 Output Select Box Chosen Option 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745558100a2663306.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论