Support

Account

Forum Replies Created

  • Here’s what I get with var_dump(get_sub_field( 'product_type' ));

    array(2) { [“value”]=> string(14) “fireplace_wood” [“label”]=> string(16) “Fireplace – Wood” }

  • I changed get_field('product_type') to get_sub_field('product_type'), but still no.

    Looking for any similar examples, I came across some that sparked a thought, that since the Return Value for the Radio Button is Both (Array), maybe I need to use variables like this, but it also didn’t work:

    <?php if ( have_rows( 'specifications' ) ) : ?>
      <?php while ( have_rows( 'specifications' ) ) : the_row(); ?>
        <?php 
          $product_type_array = get_sub_field( 'product_type' );
          $product_type_value = $product_type_array['value'];
          $product_type_label = $product_type_array['label']; ?>
        <?php if( get_sub_field($product_type_value) == 'fireplace_wood' ) { ?>
          <?php if ( have_rows( 'wood_fireplace_specs' ) ) : ?>
    	<?php while ( have_rows( 'wood_fireplace_specs' ) ) : the_row(); ?>
    	  <ul>
    	  <li><?php the_sub_field( 'heating_capacity_wf' ); ?> sq ft</li>
    	  <li><?php the_sub_field( 'maximum_burn_time_wf' ); ?> hrs</li>
    	  <li><?php the_sub_field( 'log_length_wf' ); ?>in</li>
    	  <li><?php the_sub_field( 'maximum_btus_wf' ); ?></li>
    	  <li><?php the_sub_field( 'emissions_wf' ); ?> grams per hr</li>
    	  <li><?php the_sub_field( 'efficiency_wf' ); ?>%</li>
    	  <li><?php the_sub_field( 'firebox_wf' ); ?> cubic ft</li>
    	  <li><?php the_sub_field( 'viewing_glass_wf' ); ?> sq in</li>
    	  </ul>
    	<?php endwhile; ?>
            <?php endif; ?>
        <?php } ?>
      <?php endwhile; ?>
    <?php endif; ?>

    I tried simplifying it to just test the conditional checking for Product Type, but this also doesn’t work.

    <?php if ( have_rows( 'specifications' ) ) : ?>
      <?php while ( have_rows( 'specifications' ) ) : the_row(); ?>
        <?php 
          $product_type_array = get_sub_field( 'product_type' );
          $product_type_value = $product_type_array['value'];
          $product_type_label = $product_type_array['label']; ?>
        <?php if( get_sub_field($product_type_value) == 'fireplace_wood' ) { ?>
          <p>Test</p>
        <?php } ?>
      <?php endwhile; ?>
    <?php endif; ?>

    So I’m still at a loss on what to do here.

Viewing 4 posts - 1 through 4 (of 4 total)