• Resolved lucatd

    (@lucatd)


    Hello I create this block,

    
    <?php foreach( $attributes['titolo-descrizione'] as $inner ): ?>
          
          <?php if ( $inner['regione'] ) : ?>
            <div class="acc-regione mt-1">   
              <?php echo $inner['regione']; ?>
            </div>
          <?php endif; ?>
    
          <?php if ( $inner['cantina'] ) : ?>
            <div class="acc-cantina">
              <?php echo $inner['cantina']; ?>
            </div>
          <?php endif; ?>
          
          <div class="acc-drink">
            <?php echo $inner['drink']; ?>
          </div>
          
          <div class="acc-price">
            <?php echo $inner['prezzo']; ?>
          </div>
         
        
        <?php endforeach; ?>

    the block works but in error_log_php I have this error:
    PHP Warning: Undefined array key “cantina”
    PHP Warning: Undefined array key “regione”

    Can you help me please

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter lucatd

    (@lucatd)

    Code Updated:

          <?php foreach( $attributes['titolo-descrizione'] as $inner ): ?>
          
          <?php if ( isset ( $inner['regione'] ) ) : ?>
            <div class="acc-regione mt-1">   
              <?php echo $inner['regione']; ?>
            </div>
          <?php endif; ?>
    
          <?php if ( isset  ( $inner['cantina'] ) ) : ?>
            <div class="acc-cantina">
              <?php echo $inner['cantina']; ?>
            </div>
          <?php endif; ?>
          
          <div class="acc-drink">
            <?php echo $inner['drink']; ?>
          </div>
          
          <div class="acc-price">
            <?php echo $inner['prezzo']; ?>
          </div>
         
        
        <?php endforeach; ?>
    • This reply was modified 2 years, 6 months ago by lucatd.
    Plugin Author Nikita

    (@nko)

    Hey.

    We’ll check it in the next plugin update. Most probably the repeater fields will be added once you click on Add Row button.

    Regards, nK.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Inner block with if’ is closed to new replies.