Support

Account

Home Forums Add-ons Repeater Field Liveticker (take result from first row of event repeater field)

Solving

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 ;?>
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Liveticker (take result from first row of event repeater field)’ is closed to new replies.