
Hi,
I’m not sure how to implement this code you gave me.
I’ve tried this:
<?php
$row_count = count(get_field('highlight'));
$size = 0;
if ($row_count) {
$size = (int)12/$row_count;
}
if ($size < 1) {
//force minimum of col-lg-6
$size = 6;
}
if ($size < 2) {
//force minimum of col-lg-4
$size = 4;
}
if ($size < 3) {
//force minimum of col-lg-3
$size = 3;
}
// your repeater loop here
if( have_rows('highlight') ): while ( have_rows('highlight') ) : the_row();?>
<a href="<?php the_sub_field('highlight_link');?>">
<div class="<?php echo 'col-lg-'.$size; ?> <?php echo 'col-md-'.$size; ?> <?php echo 'col-sm-'.$size; ?> <?php echo 'col-xs-'.$size; ?> highlight" style="background-image:url('<?php the_sub_field('highlight_image');?>');">
<div class="highlight_title">
<div class="highlight_title_inner">
<?php the_sub_field('highlight_title');?>
</div>
</div>
</div>
</a>
<?php endwhile; else : endif;?>
Yet it doesn’t output the classes I want.
How can I make sure that when I have:
1 item, the size is 12.
2 items, the size is 6.
3 items, the size is 4.
4 items, the size is 3.
Thanks in advance.
Found my problem.
I had a function in my functions.php what should prevent WordPress from loading emoji’s.
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
// Remove from TinyMCE
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );
Removing the next line from the function solved the problem:
// Remove from TinyMCE
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );