Support

Account

Home Forums Front-end Issues Open in new window with link array in a repeater field from the options page.

Helping

Open in new window with link array in a repeater field from the options page.

  • Hi,
    We have the owl carousel setup in the Theme Options section of our template.
    The fields call correctly for the images and links as long as it is not set to the open in a new window. If any of the images with a specified link does we get an error.

    <?php if (get_field('show_color_carousel','options')): ?>
    <!-- PARTNER SinglePage Color Logo Carousel -->
    <?php if ( have_rows('partners_list_color','options') ): ?>
        <div class="whiteBoxCarousel">
    	<div class="container">
    		<div class="col-sm-12">
    			<h6 class="owl-carousel-header"><?php the_field('partner_carousel_title_grey','options'); ?></h6>
    		</div>
    			<div class="owl-carousel" id="owl-partners">
    				<?php if( have_rows('partners_list_color','options') ): ?>
    				<?php while ( have_rows('partners_list_color','options') ) : the_row(); ?>
    				<?php $image = get_sub_field('partners_image_color','options');?>
    				<?php 
    				$p_color_link = get_sub_field('partners_logo_link_color','options');
    				if( $p_color_link ): 
    				$partners_color_link_url = $p_color_link['url'];
    				$partners_color_link_title = $p_color_link['title'];
    				$partners_color_link_target = $p_color_link['target'] ? $link['target'] : '_self';
    				?>				
    					<div class="item cardcolorpartner">
    					<?php echo esc_attr( $partners_color_link_target ); ?>
    						  <a href="<?php echo esc_url( $partners_color_link_url ); ?>" target="<?php echo esc_attr( $partners_color_link_target ); ?>">
    						<img src="<?php echo $image['url'];?>" class="card-img-top" alt="<?php echo esc_attr($image['alt']); ?>">	
    						</a>				
    					<!--  <div class="card-body">
    						<h5 class="card-title">
    							<a href=""></a>
    						  </h5>
    					  </div>-->
    					</div>	
    					<?php endif; ?>
    				<?php endwhile; ?>
    				<?php endif; ?>
    				
    			</div>
    			<!-- owl-carousel ends here -->
    	</div>
    </div>
    <!-- whiteBoxCarousel ends here -->

    Here are the ACF fields in the Options page.

    1
    Show Color Carousel show_color_carousel True / False
    2
    Partner Carousel Title partner_carousel_title_grey Text
    3
    Partners list Color partners_list_color Repeater

    3.1
    Partners Image Color partners_image_color Image
    3.2
    Partners Logo Link Color partners_logo_link_color Link

    We are using ACF Pro version 5.8.8

    Thanks in advance for help provided.

  • What error are you getting? I don’t know how this carousel works.

    Try it without esc_attr()

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

The topic ‘Open in new window with link array in a repeater field from the options page.’ is closed to new replies.