Forum Replies Created
-
AuthorPosts
-
sergeysemenov
ParticipantThanks, Anh Tran! It's all done! Topic closed
sergeysemenov
ParticipantI suppose there's something wrong with image_advanced field in nested groups.
I tried to exclude nested group, so for now my metabox looks like:// Group array( 'name' => 'Сектор инфраструктуры', 'id' => "{$prefix}sector", 'type' => 'group', 'clone' => true, 'sort_clone' => false, 'fields' => array( array( 'name' => __( 'Название сектора', 'rw_' ), 'id' => "{$prefix}sector-title", 'type' => 'textarea', 'cols' => 10, 'rows' => 1, ), array( 'name' => __( 'Описание сектора', 'rw_' ), 'id' => "{$prefix}sector-description", 'type' => 'textarea', 'cols' => 10, 'rows' => 4, ), array( 'name' => __( 'Изображение объекта', 'rw_' ), 'id' => "{$prefix}sector-object-image", 'type' => 'image_advanced', 'max_file_uploads' => 10, ), ), ),And I call it in frontend
<?php $sectors = rwmb_meta( 'rw_sector' ); if ( ! empty( $sectors ) ) { foreach ( $sectors as $sector ) { echo '<div class="object-block"> <div class="object"> <div class="sector-object-text">'; $title = isset( $sector['rw_sector-title'] ) ? $sector['rw_sector-title'] : ''; echo '<h3>' . $title . '</h3>'; $description = isset( $sector['rw_sector-description'] ) ? $sector['rw_sector-description'] : ''; echo '<p>' .$description.'</p>'; echo '</div>'; $object_img = isset( $sector['rw_sector-object-image'] ) ? $sector['rw_sector-object-image'] : ''; if ( $object_img ) { echo '<div class="sector-object-img"> <div class="slider slider-for"> <img src="' . wp_get_attachment_image_url( $object_img, 'type=image_advanced&size=full&multiple=true' ) . '"> </div> </div>'; } echo '</div> </div>'; } } ?>Title and description are displayed, but no images.
I even tried with'max_file_uploads' => 1,but no lucksergeysemenov
ParticipantThanks for assistance, Anh Tran.
One more question.
What if my field is in nested group, has 10 images uploaded and is used as a slider in the frontend? How do I call these images?array( 'name' => __( 'Name3', 'rw_' ), 'id' => "{$prefix}sector-object-img", 'type' => 'image_advanced', 'max_file_uploads' => 10, ),sergeysemenov
ParticipantThank you, Anh Tran. That works.
Good product, good support.
Topic closed.sergeysemenov
ParticipantThanks for assistance, Anh Tran. Provided code doesn't get attached image. Still looking for your help.
sergeysemenov
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.
-
AuthorPosts