Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created April 28, 2016 21:21
Show Gist options
  • Save greenhornet79/e813f3a33381342d57cbdfdfd66cb40a to your computer and use it in GitHub Desktop.
Save greenhornet79/e813f3a33381342d57cbdfdfd66cb40a to your computer and use it in GitHub Desktop.
loop through keys
<?php
$details = array(
'Garage Capacity' => get_post_meta( get_the_ID(), '_listing_garage_capacity', true ),
'Garage Type' => get_post_meta( get_the_ID(), '_listing_garage_type', true ),
'Heating' => get_post_meta( get_the_ID(), '_listing_heating', true ),
'Cooling' => get_post_meta( get_the_ID(), '_listing_cooling', true ),
'Basement' => get_post_meta( get_the_ID(), '_listing_basement', true ),
'Water Frontage' => get_post_meta( get_the_ID(), '_listing_water_frontage', true ),
'Deeded Acres' => get_post_meta( get_the_ID(), '_listing_deeded_acres', true ),
'State Lease' => get_post_meta( get_the_ID(), '_listing_state_lease', true ),
'BLM Lease' => get_post_meta( get_the_ID(), '_listing_blm_lease', true ),
'Forest Service Lease' => get_post_meta( get_the_ID(), '_listing_forest_lease', true ),
'Private Lease' => get_post_meta( get_the_ID(), '_listing_private_lease', true ),
'Irrigated Acres' => get_post_meta( get_the_ID(), '_listing_irrigated_acres', true ),
'Water Rights' => get_post_meta( get_the_ID(), '_listing_water_rights', true ),
'Irrigation Systems' => get_post_meta( get_the_ID(), '_listing_irrigation_systems', true ),
'Improvements' => get_post_meta( get_the_ID(), '_listing_improvements_include', true ),
'Retail Square Feet' => get_post_meta( get_the_ID(), '_listing_retail_square_feet', true ),
'Parking Spots' => get_post_meta( get_the_ID(), '_listing_parking_spots', true ),
'Loading Dock' => get_post_meta( get_the_ID(), '_listing_loading_dock', true ),
'Handicap Accessible' => get_post_meta( get_the_ID(), '_listing_handicap_accessible', true ),
'Security System' => get_post_meta( get_the_ID(), '_listing_security_system', true ),
'Water' => get_post_meta( get_the_ID(), '_listing_water', true ),
'Sewer' => get_post_meta( get_the_ID(), '_listing_sewer', true ),
'Construction' => get_post_meta( get_the_ID(), '_listing_construction', true ),
'Interior Extras' => get_post_meta( get_the_ID(), '_listing_interior_extras', true ),
'Exerior Extras' => get_post_meta( get_the_ID(), '_listing_exterior_extras', true ),
'Access' => get_post_meta( get_the_ID(), '_listing_access', true ),
'Road Access' => get_post_meta( get_the_ID(), '_listing_road_access', true ),
'Property Taxes' => get_post_meta( get_the_ID(), '_listing_property_taxes', true ),
'Zoning' => get_post_meta( get_the_ID(), '_listing_zoning', true ),
);
?>
<ul class="listing-details-box-list">
<?php
// so that mls and agency ids are listed first in the list
foreach( $details as $key => $value ) {
if ( !$value ) {
continue;
}
echo '<li><strong>' . $key . ':</strong> ' . $value . '</li>';
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment