Advance image is not showing up

Support MB Group Advance image is not showing up

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8429
    alishaalisha
    Participant

    First of all,
    Thanks for making this awesome plugin.
    I have created a group field using following codes:

    // Gallery Post Options
    		$meta_boxes[] = array(
    			'id'         => 'goalkick_format_gallery',
    			'title'      => __( 'Gallery Post Options', 'goalkick' ),
    			'post_types' => array( 'post' ),
    			'context'    => 'normal',
    			'priority'   => 'high',
    			'autosave'   => true,
    			'fields'     => array(
    				
    				array(
    					'name'				=> __( 'Gallery Images', 'goalkick' ),
    					'id'				=> "{$prefix}post_gallery",
    					'type'				=> 'group',
    					'clone'  => true,
    					'fields' => array(
    						array(
    							'name' => 'Gallery Image',
    							'id'   => "{$prefix}post_gallery_images",
    							'type' => 'image_advanced',
    							'max_file_uploads'  => 1,
    						),
    						array(
    							'name' => 'Image Description',
    							'id'   => "{$prefix}post_gallery_images_des",
    							'type' => 'text',
    						),
    					),
    				),
    			)
    		);

    And I am using following codes to show the contents,text is showing up perfectly but the problem is image.It is not showing up.I have tried using three options but no positive result.Please help me.

    <article id="post-<?php the_ID(); ?>"  class="news-post-box col-md-4">
    			<?php
    			$group = get_post_meta( get_the_ID(), 'football_post_gallery', true );
    
    			if( $group ) { ?>
    			<div class="post-media">
    
    				<div class="post-gallery-wrapper ">
    					<ul class="">
    						<li>
    							<span>
    								<?php
    								foreach ( $group as $group ) {
    									$heading = isset( $group['football_post_gallery_images_des'] ) ? $group['football_post_gallery_images_des'] : '';
    									echo $heading;
    
    								}
    
    								?>
    							</span>
    							<span>
    								<?php
    								foreach ( $group as $group ) {
    									$images = isset( $group['football_post_gallery_images'] ) ? $group['football_post_gallery_images'] : array();
    									foreach ( $images as $image ) {
    										//option one 
    										$image_info = RWMB_Image_Field::file_info( $image, array( 'size' => 'featured-full' ) ); 
    										echo '<img src="' . $image_info['url'] . '" width="' . $image_info['width'] . '" height="' . $image_info['height'] . '" />';
    										//option two
    										echo '<img src="' . wp_get_attachment_image_url( $image, 'featured-full' ) . '" />';
    										//option three
    										echo wp_get_attachment_image( $image["ID"], "featured-full" ); 
    									}
    								}
    								?>
    							</span>
    						</li>
    					</ul>
    				</div>
    				<?php } ?>
    			</div><!-- End .post-media -->
    
    		</article><!-- post-box end -->
    #8438
    Tu DuongTu Duong
    Participant

    Hello,
    Have you checked the code you send, then see the image displayed normally,
    Only the 3rd image is wrong because you have the wrong one.
    I send you 3 photos you checked, you check back

    1: add metabox
    https://prnt.sc/i9hss1

    2: code show image + error image 3rd
    https://prnt.sc/i9hqs6

    3: frontend
    https://prnt.sc/i9hqg9

    #8439
    alishaalisha
    Participant

    It was my mistake.I used the group variable for one time and foreach loop for two times.That's why it was not working.Thanks

    https://pastebin.com/TQANDyXF

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Advance image is not showing up’ is closed to new replies.