foreach.php

// Start UL (Unordered List)
echo “

    “;

    // Get the field value
    $amenities = get_custom_field( ‘job_amentities’ );

    // Make sure there is a value
    if( ! empty( $amentities ) ){

    // An Array would be multiple selections
    if( is_array( $amentities ) ){

    // Loop through each one and output it in a LI (List Item)
    foreach( $amenities as $amentity ){
    echo “

  • ” . $amentity . “
  • “;
    }

    // One selection would be a single
    } else {
    echo “

  • ” . $amentities . “
  • “;
    }

    }
    echo “

“;

foreach.php

// Start UL (Unordered List)
echo "<ul>";

// Get the field value
$amenities = get_custom_field( 'job_amentities' );

// Make sure there is a value
if( ! empty( $amentities ) ){

    // An Array would be multiple selections
    if( is_array( $amentities ) ){
    
        // Loop through each one and output it in a LI (List Item)
        foreach( $amenities as $amentity ){
            echo "<li>" . $amentity . "</li>";
        }
    
    // One selection would be a single 
    } else {
        echo "<li>" . $amentities . "</li>";
    }

}
echo "</ul>";
No comments yet.

Leave a Reply