Support

Account

Home Forums Add-ons Repeater Field How to add a class into a div inside a row?

Helping

How to add a class into a div inside a row?

  • Hello Guys, I have a question, I have this code and I’m using the Repeater Field:

    
    
    	<li class="<?php echo $i; ?>">
            <div class="title"><h1><?php echo $row['productname']; ?></h1></div>
            <div class="price">
              <h2><?php echo $row['pricenormal']; ?></h2>
              <h3><?php echo $row['priceoffer']; ?></h3>
            </div>
            <div class="desc"><?php echo $row['description']; ?></div>
        	</li>
     

    All I need is to add a “first” Class to my first

  • tag, I’ve already tried li:first-child and didn’t work, btw, I’m using $row foreach:
    // check if the repeater field has rows of data
    $rows = get_field('pizzas_salgadas');
    if($rows) {
    ?>
     
    <?php
     	// loop through the rows of data
        foreach($rows as $row) {
            // display a sub field value
    
        	?>
    

    Thanks for the help!

  • Hey, don’t suppose you found the answer to this did you?

    I need to do exactly the same thing for a custom Genesis theme

    Thanks

    Brad

  • Viewing 2 posts - 1 through 2 (of 2 total)

    The topic ‘How to add a class into a div inside a row?’ is closed to new replies.