I wonder how do I add an additional value next to ‘epigenetics’ in the statement below:

<?php
// check if the flexible content field has rows of data
if( have_rows('epigenetics', 'user_'.get_current_user_id()) ): ?>
<tbody>
  <?php $count = 0;
  while ( have_rows('epigenetics', 'user_'.get_current_user_id()) ) : 
the_row(); 
    $count++; ?>
    <tr class="tablerow<?php echo $count; ?>">
        <td style="background-color: #92c38e; text-align: center;">
            <p><span style="font-size: medium;"><?php  
        the_sub_field('category'); ?></span></p>
        </td>
        <td style="background-color: #92c38e; text-align: center;">
            <p><span style="color: #ffffff; font-size: medium;"><?php 
        the_sub_field('item'); ?></span></p>
        </td>            
        <td style="background-color: #92c38e; text-align: center;">
            <p><span style="color: #ffffff; font-size: medium;"><?php 
        the_sub_field('status'); ?></span></p>
        </td>     
  <?php endwhile; ?>
</tbody> 
<?php else :

endif;
?>

I have tried with a semicolon or with a comma but it did not work.

Basically, the PHP code is pulling data from an XML file and displaying it on the table. the row ‘epigenetics’ populates the sun_fields ‘item’ and ‘status’ while the sub_field category should be populated by a row called ‘category’.

So I tried the following but did not work:

<?php
// check if the flexible content field has rows of data
if( have_rows('epigenetics, category', 'user_'.get_current_user_id()) 
): ?>
<tbody>
  <?php $count = 0;
  while ( have_rows('epigenetics; category', 
  'user_'.get_current_user_id()) ) : 
   the_row(); 
    $count++; ?>
    <tr class="tablerow<?php echo $count; ?>">
        <td style="background-color: #92c38e; text-align: center;">
            <p><span style="font-size: medium;"><?php  
        the_sub_field('category'); ?></span></p>
        </td>
        <td style="background-color: #92c38e; text-align: center;">
            <p><span style="color: #ffffff; font-size: medium;"><?php 
        the_sub_field('item'); ?></span></p>
        </td>            
        <td style="background-color: #92c38e; text-align: center;">
            <p><span style="color: #ffffff; font-size: medium;"><?php 
        the_sub_field('status'); ?></span></p>
        </td>     
  <?php endwhile; ?>
</tbody> 
<?php else :

endif;
?>

Read more here: Add a value on a string


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: