jcchavezs / cmb2-taxonomy

Custom metaboxes for taxonomies
GNU General Public License v2.0
34 stars 8 forks source link

Does not appear to function properly with built in categories. #3

Open estin1985 opened 9 years ago

estin1985 commented 9 years ago

A Category is a taxonomy type. Tested it with category listed as the object type, and it does not render any inputs.

jcchavezs commented 9 years ago

Hi @estin1985, can you give me more details about the environment?

estin1985 commented 9 years ago

Sure! I am using the latest CMB2 (2.0.8), wordpress latest and CMB2-Taxonomy latest. It can easily be tested, just use the example functions but change the object_types array to have category. Category is a taxonomy type, but this plugin does not render in for the default categories. If it did, this would be an excellent replacement for Taxonomy MetaData

danieljulia commented 9 years ago

I'm getting always empty values with a custom taxonomy.. last version of cmb2 and cmb2-taxonomy f.i. $autor is the custom taxonomy term get_post_meta( $autor->term_id, '_myprefix_foto' ); returns an empty array (the id and name is correct)

marsshall commented 9 years ago

@danieljulia me too, with same approach... :(

$tax = 'prod_category';
$tax_terms = get_terms($tax);

foreach ($tax_terms as $key => $tax_term) {

     $prefix = '_prod_category_';
     $tax_icon = get_post_meta($tax_term->term_id, $prefix.'icon', true);

}
marsshall commented 9 years ago

@danieljulia We r using get_post_meta, but for term is necessary to use get_term_meta. There are no instruction to do this, but exploring plugin functions.php I found it.

Hope this help you :)

danieljulia commented 9 years ago

You are right!! Thanks!

in my sample would be get_term_meta( $autor->term_id, '_myprefix_foto' ); instead of get_post_meta( $autor->term_id, '_myprefix_foto' );

jcchavezs commented 9 years ago

Thank you @marsshall for the assitance. I am extremely busy this days so I could not follow up this issue. I will add the documentation for this soon.

marsshall commented 9 years ago

@jcchavezs @danieljulia You're welcome :)

jcchavezs commented 9 years ago

By the way, I just added some documentation for the usage: https://github.com/jcchavezs/cmb2-taxonomy#usage. cc/ @danieljulia @marsshall