How i can custom fields taxonomy example?
Thanks guys.
Please clarify what you're asking. Have you looked at the wiki? https://github.com/CMB2/CMB2/wiki/Field-Types#taxonomy_radio
I would like to create custom fields in a taxonomy and not in a post_type.,
Sorry my english!!
Thanks for repply @jtsternberg
Examples for registering fields for each type of data can be found here: https://github.com/CMB2/CMB2/wiki/Examples
For terms (taxonomies), specifically here: https://github.com/CMB2/CMB2/blob/b1a7e8fb9f0634337b390a098f0a1f70f0f64085/example-functions.php#L601-L641
one more question..
how i can tel CMB2 this is posty_type multicheck in my code?
$cmb->add_field( array(
'name' => esc_html__( 'Grades canais', 'cmb2' ),
'desc' => esc_html__( 'myfield', 'cmb2' ),
'id' => $prefix . 'grade',
'type' => 'taxonomy_multicheck',??? // how i can say here post_type???
'taxonomy' => 'grade',
'inline' => true,
'select_all_button' => false,
) );
veryyyyyy thanks , save my live :+1:
I don't understand the question. That is a taxonomy field type. To define the post-type, you have to do it at the metabox registration.
If I understand correctly, probably wanting to use Custom Post Type powered WordPress taxonomies. Like this plugin:
https://wordpress.org/plugins/cpt-onomies/
I solved my problems , Thanks @GitaStreet @jtsternberg !!
I wiill search how i can display custom fields in my vew!
thanks!!
Sorunlarımı çözdüm , teşekkürler @GitaStreet @jtsternberg !!
Vew'de özel alanları nasıl görüntüleyebileceğimi araştıracağım!
Teşekkürler!!
How did you do the viewing? I could not do it somehow
Examples for registering fields for each type of data can be found here: https://github.com/CMB2/CMB2/wiki/Examples
For terms (taxonomies), specifically here:
How can I show added filed output in frontend?
@ahamed-sojib You'll want to use something like https://developer.wordpress.org/reference/functions/get_term_meta/ to start fetching these fields. Do note that you'll want to use the TERM ID, as opposed to POST ID. So you'll need to get term objects for the terms assigned to the given post.
@ahamed-sojib You'll want to use something like https://developer.wordpress.org/reference/functions/get_term_meta/ to start fetching these fields. Do note that you'll want to use the TERM ID, as opposed to POST ID. So you'll need to get term objects for the terms assigned to the given post.
but why it is not working can you help me ?
$cat_thumbnail = wp_get_attachment_image( get_term_meta( get_the_ID(), 'categories_thumbnail_metabox', 1 ), 'full' );
echo esc_url($cat_thumbnail);
the get_the_ID() usage is passing the post ID, not term ID. See my previous comment about that part. Something like https://developer.wordpress.org/reference/functions/get_the_terms/ would get you the terms on the post, to then use with what you're doing here.
the
get_the_ID()usage is passing the post ID, not term ID. See my previous comment about that part. Something like https://developer.wordpress.org/reference/functions/get_the_terms/ would get you the terms on the post, to then use with what you're doing here.
Thanks, Man! It is working now.
Most helpful comment
Examples for registering fields for each type of data can be found here: https://github.com/CMB2/CMB2/wiki/Examples
For terms (taxonomies), specifically here: https://github.com/CMB2/CMB2/blob/b1a7e8fb9f0634337b390a098f0a1f70f0f64085/example-functions.php#L601-L641