Home Forums Add-ons Gallery Field Image display issues


Image display issues

  • Hi everybody,

    I made a page where all the posts are visible and show my custom fields. Everything works well except the gallery. For some reason, at the load, I see all pictures of each gallery and if I change to an other browser tab and go back, I can see one picture only.

    I don’t understand why is doing this.

    You can have a look here.

    And here is the code here

    		// the query
    		$the_query = new WP_Query( array (    'category_name' => 'test-work' ) ); ?>
    		<?php if ( $the_query->have_posts() ) : ?>
    			<!-- pagination here -->
    			<!-- the loop -->
    			<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    				<div class="bloc <?php the_field('center_content'); ?>">
    				<?php if (get_field('centrage_image') ): ?>
    					<div class="works <?php the_field('centrage_image'); ?>">
    						<div class="works_img">
    							$images = get_field('gallery2');
    							if( $images ): ?>
    							    <div id="slide" class="flexslider">
    							        <ul class="slides">
    							        <?php foreach( $images as $image ): ?>
    							                <img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
    							        <?php endforeach; ?>
    						<?php endif; ?>
    							<!-- end slide -->
    								$image = get_field('image');
    								if( !empty($image) ): ?>
    								<div class="image_taff">
    									<img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
    								<?php endif; ?>
    								<?php if (get_field('inprogress', get_the_id()) ): ?>
    								<div class="progress">
    									<img src="" alt="En Cours" />
    							<?php endif; ?>
    								<?php if (get_field('informations') ): ?>
    						<div class="txt_infos">
    							<?php the_field('informations'); ?>
    					<?php endif; ?>
    				<?php endif; ?>
    			<?php endwhile; ?>
    			<!-- end of the loop -->
    			<!-- pagination here -->
    			<?php wp_reset_postdata(); ?>
    		<?php else : ?>
    			<p><?php esc_html_e( 'Désolé, rien ne correspond!' ); ?></p>
    <?php endif; ?>

    Many thanks for the help !

  • First var_dump the field

  • This reply has been marked as private.
  • Ok, I var_dump the filed and I have the informations about the picture and the size seems correct like this. But like I say, now I see the informations and I don’t know what is the next step.

    Can you help me ?

  • Actually, I found the issue of my problem. I had to write à width 100% on the main content, if not, I have the issue.

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

The topic ‘Image display issues’ is closed to new replies.