Home › Forums › Add-ons › Repeater Field › Liveticker (take result from first row of event repeater field)
Hello everybody,
first thanks for this awesome plugin!
I really enjoy using it a lot for a sports club website.
The liveticker is one that’s based on acf.
http://redesign.derschlag-handball.de/liveticker
My only question is, if it’s possible that the result panel (top) takes it’s values from the result of the first row of the events (goals, fouls, etc).
Currently i typed the actual result twice.. which costs time while watching the game and documenting all events.
Your Documentation couldn’t help me. But I’m sure you can 🙂
Can you not simply use the first row of the repeater:
<?php
$rows = get_field('repeater_field_name' ); // get all the rows
$first_row = $rows[0]; // get the first row
$first_row_image = $first_row['sub_field_name' ]; // get the sub field value
// Note
// $first_row_image = 123 (image ID)
$image = wp_get_attachment_image_src( $first_row_image, 'full' );
// url = $image[0];
// width = $image[1];
// height = $image[2];
?>
<img src="<?php echo $image[0]; ?>" />
Taken from here: Repeater Documentation
I tried but it didn’t work. Maybe you could change the code the way I used the repeater fields?
<?php $attachment_id = get_field('liveticker_logo_heim', 'option');
$size = 'medium'; // (thumbnail, medium, large, full or custom size)
echo wp_get_attachment_image( $attachment_id, $size );
?>
</div>
<div class="logo_gast">
<?php $attachment_id = get_field('liveticker_logo_gast', 'option');
$size = 'medium'; // (thumbnail, medium, large, full or custom size)
echo wp_get_attachment_image( $attachment_id, $size );
?>
</div>
<div class="clear"></div>
<div class="ergebnis">
<div class="tore_heim"><?php the_field( "liveticker_tore_heim", 'option' );?></div>
<div class="ergebnis_zeichen">:</div>
<div class="tore_gast"><?php the_field( "liveticker_tore_gast", 'option' );?></div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="liveticker_box">
<?php if(get_field('spielverlauf', 'option')): ?>
<?php while(has_sub_field('spielverlauf', 'option')): ?>
<div class="liveticker_wrapper">
<ul>
<li class="liveticker_ergebnis">
<?php if(get_sub_field('minute')) : ?>
<p><?php the_sub_field('minute');?>. Minute<br/>
<?php else : ?><br/>
<?php endif ;?>
<?php if(get_sub_field('liveticker_tore_heim')) : ?>
<?php the_sub_field('liveticker_tore_heim');?> : <?php the_sub_field('liveticker_tore_gast');?></p>
<?php else : ?>
<?php endif ;?>
The topic ‘Liveticker (take result from first row of event repeater field)’ is closed to new replies.
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’re hard at work on ACF 6.1, and Beta 1 is now available 🚀
— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.
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.