• Resolved seansean11

    (@seansean11)


    I’m not sure if this problem is specific to the ACF plugin, but I am using the repeater field add on to create an image slider. It is working fine, except for the fact that the url for the image is stripped of its backslashes. I can’t find anything about this anywhere and I’m more of a front-end guy. Please take a look. Here is my code:

    <?php
    
    	if(get_field('header_slider')) {
    
    		while(has_sub_field('header_slider')) { ?>
    			<?php $image = wp_get_attachment_image_src(get_sub_field('slider_image'), 'homepage' ); ?>
    			<div style="background-image: url("<?php echo $image[0]; ?>")">
    				<h2 class="home-title"><?php echo get_sub_field('slider_title'); ?></h2>
    				<p class="home-caption"><?php echo get_sub_field('slider_caption'); ?></p>
    			</div>
    
    		<?php }
    	}
    	?>

    this code is producing this html

    <div style="background-image: url(" http: localhost acrossamerica wp-content uploads 2012 12 slider_cali1.jpg")">
    		<h2 class="home-title">Title #2</h2>
    		<p class="home-caption">Caption #2</p>
    </div>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Advanced Custom Fields] Backslashes stripped from sub_field’ is closed to new replies.