Support

Account

Home Forums General Issues Only display repeater field from post based on true / false

Solved

Only display repeater field from post based on true / false

  • Hello everyone, I’ve currently ran into a wall with an issue. I’ve set up a template page to show images that are highlights of each post.

    On each post I have a repeater field with a true / false field. If toggled then it will show on the page.

    While it does show all the images that have been selected from each from each project (CPT), I also provide a link to the project and title as well. But it doesn’t show correctly.

    The beginning of the slide should go in order from when each project was published but it doesn’t, and all the slides do not show match up with the project title displayed. E.g. The slide labeled “Project 1” will show a Project 2 Image instead of Project 1 image.

    I don’t believe this is related to the slider I’m using but I think it has something to do with my code and I’m not sure whats wrong with it.

    function all_sliders() {
    
    $args = array('posts_per_page' => -1, 'post_type' => 'project', 'orderby' => 'publish_date', 'order' => 'ASC', 'post_status' => 'publish');                                                
    $slide_query = new WP_Query( $args ); ?>
    
    <div class="carousel-outer-wrapper destroy-on-mobile slideshow js-viewport-animation"> 
    
    <div class="carousel-wrapper"> 
    
    <div class="slider-highlight"> 
    
    <?php if ( $slide_query->have_posts() ) : ?>
    <?php while ( $slide_query->have_posts() ) : ?>
    <?php $slide_query->the_post(); ?>  
    <?php if ( have_rows( 'project_gallery_section' ) ) : ?>
    <?php while ( have_rows( 'project_gallery_section' ) ) : ?>
    <?php the_row(); ?>
    
    <?php $project_image = get_sub_field( 'project_image' );  ?>
    
    <?php if ( get_sub_field( 'showcase_image' ) !== false ) : ?>
    
    <?php get_sub_field( 'type_of_image' ); ?>
    
    <?php if ( $project_image ) : ?>
    
    <div class="inner-slide">
    <div class="inner-slide-image-wrapper">
    <figure role="img">
    <img src="<?php echo $project_image['url']; ?>" alt="<?php echo $project_image['alt']; ?>" />
    </figure>
    
    <p class="slide-text" data-project="<?php echo get_the_title();?>">
    <span><?php echo  get_the_title(); ?></span>
    <span><a href="<?php echo get_post_permalink(); ?>" class="nu">Project Link</a></span>
    </p>
    </div>
    </div>
    
    <?php endif; ?>
    <?php endif; ?>
    
      <?php endwhile; ?>
    <?php else : ?>
      <?php // no rows found ?>
    <?php endif; ?>
    
    <?php endwhile; ?>
    
    </div>
    </div>
    </div>
    
    <div class="desktop-title-text row center-xs js-viewport-animation">
    <div class="desktop-title-inner-text">
    <p></p>
    </div>
    <div class="slide-count-wrap">
    <span class="current"></span> of <span class="total"></span>
    </div>
    </div>
    
    <?php wp_reset_postdata(); ?>
    <?php endif; ?>
    
    <?php }

    If anyone needs a link to see the page and what i’m referring to I’ll send it over. I would greatly appreciate it!

  • Figured out the problem!

  • And how? 🙂 The advice would be helpfull.

  • On each post I have a repeater field with a valid/misleading field. In the event that flipped, it will show on the page.

    While it shows every one of the pictures that have been chosen from each from each venture (CPT), I likewise give a connection to the task and title too. However, it doesn’t show accurately.
    Thanks.
    aem development company

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

You must be logged in to reply to this topic.