Ce n’est pas un problème d’ACF. Cela est dû au passage au nouvel éditeur (Gutenberg). Selon cette page: https://calderaforms.com/2018/06/gutenberg-existing-shortcodes/, si vous cliquez sur le bloc (Classique), vous obtiendrez un menu. Dans le menu, sélectionnez “Convertir en blocs”. Vous devriez alors voir un bloc de codes courts éditable. Bonne chance!
Just solved it myself! Here’s the answer (might conceivably be of use to someone else):
<!-- slideshow -->
<?php if( have_rows('news_slideshow') ): ?>
<!-- data-ratio="820/542" -->
<div class="the-slideshow slideshow-news">
<div class="fotorama"
data-width="100%"
data-ratio="820/542"
data-minwidth="285"
data-loop="true"
data-swipe="true"
data-click="true"
data-nav="false"
data-transition="crossfade"
data-transitionduration="1500"
data-autoplay="4000">
<?php while ( have_rows('news_slideshow') ) : the_row(); ?>
<?php if( !empty(get_sub_field('news_slideshow_image')) ) : ?>
<?php
$slideLarge = get_sub_field('news_slideshow_image');
$size = 'full'; // (thumbnail, medium, large, full or custom size)
?>
<?php echo wp_get_attachment_image( $slideLarge, $size ); ?>
<?php else: ?>
<?php echo 'something else'; ?>
<?php endif; ?>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<!-- end slideshow -->
Thanks John – however, a detailed solution came through (which I think you were pointing me towards) from James on [email protected] which does exactly what I want. Code is (to put in [theme]/functions.php) :
function my_acf_load_value( $value, $post_id, $field ) {
$content = apply_filters('the_content',$value);
$content = force_balance_tags( $content );
$content = preg_replace( '#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content );
$content = preg_replace( '~\s?<p>(\s| )+</p>\s?~', '', $content );
return $content;
}
add_filter('acf/load_value/type=wysiwyg', 'my_acf_load_value', 10, 3);
No more empty <p> tags in ACF Wysisyg fields!
John – fixed it – my fault!
I repeated ‘the_row();’ twice!
<?php while ( have_rows(‘news_slideshow’) ) : the_row(); ?>
<?php the_row(); ?>
All good now.
Thanks very much for your help.
Chris
here’s the code I’m using:
<?php if( have_rows('news_slideshow') ): ?>
<?php while ( have_rows('news_slideshow') ) : the_row(); ?>
<?php the_row(); ?>
<div>
<img src="<?php the_sub_field('news_slideshow_image'); ?>" alt="">
</div>
<?php break; ?>
<?php endwhile; ?>
<?php endif; ?>
Hi John,
your solution was a way lot simpler than mine and almost worked –
but I found that the second slide was displayed, not the first! 🙁
Any ideas to tweak the code so that it shows just the first one?
Thanks anyway!
Chris
Answering my own question!
Found answer on this page: https://www.advancedcustomfields.com/resources/repeater/ under sub-heading: “Get the first row from a repeater“.
Thanks for your help Jonathan.
Just one thing: “echo implode(‘, ‘, $likes_list);” no longer required!
Thanks again.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.