Support Forum ยป User Profile

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Can't get image to output #7459
    chimovskichimovski
    Participant

    Managed 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']}' />";
    					}
    
    				}
    
    ?>
    in reply to: Can't get image to output #7451
    chimovskichimovski
    Participant

    taking 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.

    in reply to: Include for only posts with category isn't working #3801
    chimovskichimovski
    Participant

    Awesome, working perfectly now. Thank you so much.

    in reply to: Include for only posts with category isn't working #3797
    chimovskichimovski
    Participant

    I'm running latest I think:

    Metabox 4.8.7
    Meta-box-include-exclude 1.0.4

    I also have metabox group installed 1.1.3

    thanks

Viewing 4 posts - 1 through 4 (of 4 total)