Forum Replies Created
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
chimovski
ParticipantManaged to sort it. I wasn't query the terms properly.
<?php $custom_terms = get_terms('base_sector'); foreach($custom_terms as $custom_term) { $term_id = $custom_term->term_id; $image_ids = get_term_meta( $term_id, 'tax_img', false ); foreach ( $image_ids as $image_id ) { $image = RWMB_Image_Field::file_info( $image_id, array( 'size' => 'thumbnail' ) ); echo "<img src='{$image['url']}' alt='{$image['alt']}' />"; } } ?>chimovski
Participanttaking from the example in the documentation
// Getting images $image_ids = get_term_meta( $term_id, $field_id, false ); // Media fields are always multiple. foreach ( $image_ids as $image_id ) { $image = RWMB_Image_Field::file_info( $image_id, array( 'size' => 'thumbnail' ) ); echo '<img src="' . $image['url'] . '">'; }I've setup the metaboxes like this
add_filter( 'rwmb_meta_boxes', 'prefix_register_taxonomy_meta_boxes' ); function prefix_register_taxonomy_meta_boxes( $meta_boxes ){ $meta_boxes[] = array( 'title' => 'Extra info', 'taxonomies' => 'base_sector', // List of taxonomies. Array or string 'fields' => array( // featured image array( 'name' => 'Featured Image', 'id' => 'tax_img', 'type' => 'image_advanced', ), ), ); return $meta_boxes; }I've been playing around with it for hours and can't get it to work.
chimovski
ParticipantAwesome, working perfectly now. Thank you so much.
chimovski
ParticipantI'm running latest I think:
Metabox 4.8.7
Meta-box-include-exclude 1.0.4I also have metabox group installed 1.1.3
thanks
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)