Support

Account

Home Forums Add-ons Gallery Field Image display issues

Solved

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

    
    
    		<?php
    
    		// 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">
    title
    							<?php
    
    							$images = get_field('gallery2');
    
    							if( $images ): ?>
    							    <div id="slide" class="flexslider">
    							        <ul class="slides">
    							        <?php foreach( $images as $image ): ?>
    
    							            <li>
    							                <img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
    							            </li>
    							        <?php endforeach; ?>
    							    </ul>
    							</div>
    
    						<?php endif; ?>
    
    							<!-- end slide -->
    
    							<?php
    								$image = get_field('image');
    								if( !empty($image) ): ?>
    
    								<div class="image_taff">
    									<img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
    								</div>
    								<?php endif; ?>
    
    								<?php if (get_field('inprogress', get_the_id()) ): ?>
    
    								<div class="progress">
    									<img src="https://lesbandits.ch/lesbandits/wp-content/themes/panpan/img/les_bandits_etoile.svg" alt="En Cours" />
    								</div>
    							<?php endif; ?>
    
    								<?php if (get_field('informations') ): ?>
    
    						<div class="txt_infos">
    							<?php the_field('informations'); ?>
    						</div>
    
    					<?php endif; ?>
    
    					</div>
    
    					</div>
    				<?php endif; ?>
    				</div>
    
    			<?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>
    
    	</article>
    
    <?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 ?
    Cheers

  • 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)

You must be logged in to reply to this topic.