次のスクリプトは、広告主フィールド「cp_street」、「cp_city」、および「cp_state」をコンパイルして、Webサイトのサイドバーマップを呼び出すアドレスを作成します。ユーザーが代わりに完全なアドレスを入力できる「cp_address」という新しいフィールドを作成しました。両方が機能するように、以下のスクリプトを変更するにはどうすればよいですか?
<?php
// check to see if ad is legacy or not and then assemble the map address
if ( get_post_meta($post->ID, 'location', true) )
$make_address = get_post_meta($post->ID, 'location', true);
else
$make_address = get_post_meta($post->ID, 'cp_street', true) . ' ' . get_post_meta($post->ID, 'cp_city', true) . ' ' . get_post_meta($post->ID, 'cp_state', true) . ' ' . get_post_meta($post->ID, 'cp_zipcode', true);
$coordinates = cp_get_geocode( $post->ID );
?>
<script type="text/javascript">var address = "<?php echo esc_js($make_address); ?>";</script>
<?php cp_google_maps_js($coordinates); ?>