Image Advanced

Support MB Group Image Advanced

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2521
    sergeysemenovsergeysemenov
    Participant

    Hi!

    <?php $group_value = rwmb_meta( 'rw_mygroup' );
    
    foreach ( $group_value as $group_value )
    {
        echo '<div>
        		<div class="image"><img src="' . $group_value['rw_img'] . '" /></div>
    			<div>' . $group_value['rw_textfield1'] . '</div>
    			<div>' . $group_value['rw_textfield2'] . '</div>
    			<div>' . $group_value['rw_textfield3'] . '</div></div>';
    } ?>

    Everything works great with file_input, but not retrieve img with image_advanced. Could you please provide the php code to call image_advanced attachment in the template.

    #2522
    sergeysemenovsergeysemenov
    Participant
    <?php $group_value = rwmb_meta( ‘rw_mygroup’ );
    
    foreach ( $group_value as $group_value )
    {
    echo ‘<div>
    <div class=”image”><img src="' . $group_value['rw_img'] . '"></div>
    <div>’ . $group_value[‘rw_textfield1’] . ‘</div>
    <div>’ . $group_value[‘rw_textfield2’] . ‘</div>
    <div>’ . $group_value[‘rw_textfield3’] . ‘</div></div>’;
    } ?>

    Everything works great with file_input, but not retrieve img with image_advanced. Could you please provide the php code to call image_advanced attachment in the template.

    #2537
    Anh TranAnh Tran
    Keymaster

    Hi Sergey Semenov,

    The value stored by image_advanced is attachment ID, so when you get them, you will receive an array of integers. (The helper function doesn't work pretty well for group at the moment and I will fix it soon so it can return more info of the image instead of just ID).

    In the meantime, please try this code:

    <?php $group_value = rwmb_meta( 'rw_mygroup' );
    foreach ( $group_value as $group_value )
    {
    
       	echo '<div>
          	 	<div class="image"><img src="' . wp_get_attachment_image_url( $group_value['rw_img'], 'thumbnail' ) . '" /></div>
    	   		<div>' . $group_value['rw_textfield1'] . '</div>
    	   		<div>' . $group_value['rw_textfield2'] . '</div>
    	   		<div>' . $group_value['rw_textfield3'] . '</div>
       	</div>';
    } ?>

    You can change the code to use different image size if you want.

    #2565
    sergeysemenovsergeysemenov
    Participant

    Thanks for assistance, Anh Tran. Provided code doesn't get attached image. Still looking for your help.

    #2576
    Anh TranAnh Tran
    Keymaster

    Sorry, here is the correct one:

    $group_values = rwmb_meta( 'rw_mygroup' );
    foreach ( $group_values as $group_value )
    {
    	echo '<div>
    		<div class="image"><img src="' . wp_get_attachment_image_url( reset( $group_value['rw_img'] ), 'thumbnail' ) . '" /></div>
    		<div>' . $group_value['rw_textfield1'] . '</div>
    		<div>' . $group_value['rw_textfield2'] . '</div>
    		<div>' . $group_value['rw_textfield3'] . '</div>
    	</div>';
    }
    #2585
    sergeysemenovsergeysemenov
    Participant

    Thank you, Anh Tran. That works.
    Good product, good support.
    Topic closed.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Image Advanced’ is closed to new replies.