有人能解释一下,我将如何重写这段代码,以包括一个电话号码:可点击的电话号码,并使电子邮件地址可点击到信息:嗨。com公司
我在这方面有点麻烦。
<address class="address_phone">
<span class="icon icon-phone"></span>
<div class="contact_title"><?php echo esc_html__(\'Phone:\', \'yogastudio\') ?></div>
<span class="contact_item phone"><?php if (!empty($phone)) echo esc_html($phone); ?></span>
</address></div><div class="column-1_3">
<address class="address_email">
<span class="icon icon-mail"></span>
<div class="contact_title"><?php echo esc_html__(\'Email:\', \'yogastudio\') ?></div>
<span class="contact_item mail"><?php if (!empty($email)) echo esc_html($email); ?></span>
</address></div>
最合适的回答,由SO网友:Pratikb.Simform 整理而成
请按以下方式编辑您的代码:
<address class="address_phone">
<span class="icon icon-phone"></span>
<div class="contact_title"><?php echo esc_html__(\'Phone:\', \'yogastudio\') ?></div>
<span class="contact_item phone">
<?php if (!empty($phone)) { echo \'<a href="tel:\'.$phone.\'">\'.esc_html($phone).\'</a>\';} ?>
</span>
</address></div><div class="column-1_3">
<address class="address_email">
<span class="icon icon-mail"></span>
<div class="contact_title"><?php echo esc_html__(\'Email:\', \'yogastudio\') ?></div>
<span class="contact_item mail"><?php if (!empty($email)) { echo \'<a href="mailto:\'.$email.\'">\'.esc_html($email).\'</a>\';}?></span>
</address></div>