I am using advanced custom fields to display content from a url. The fields have default content in them (the url I mentioned). I am using conditional logic on a radio button that has the ID ("nearestCity") when New York is selected it displays the field that holds the New York url. The problem is since the "field ids" are different the content doesn't display so I wanted to write a conditional statement that re-defines the variable when "New York" is selected.
I've tried using the same IDs and writing an IF statement but both just break the page
<?php
$propertiesCity = get_post_meta($post->ID, 'propertiescityname', true);
$msa = get_post_meta($post->ID, 'propertiesmsa', true);
?>
<?php
/*code for adding nearest new york city*/
$newYorkSelect = get_post_meta($post->ID, 'nearest_city', true);
if ($newYorkSelect == "new york") { ?>
<?
$propertiesCity = get_post_meta($post->ID, 'propertiescityname-new-york', true);
$msa = get_post_meta($post->ID, 'propertiesmsa-new-york', true);
?>
<?php
} else {
// do nothing;
}
?>
Aucun commentaire:
Enregistrer un commentaire