WP使Avatar成为超链接

我在wordpress模板的这一部分行中显示了团队成员的名称并对其进行超链接。该超链接将重定向到该成员的实际页面。

<h4 class="sc_team_item_title"><?php echo (!empty($post_options['link']) ? '<a href="'.esc_url($post_options['link']).'">' : '') . (!empty($post_data['post_id']) ? insurance_ancora_get_post_title($post_data['post_id']) : '') . (!empty($post_options['link']) ? '</a>' : ''); ?></h4>

该行上方是显示该团队成员照片的行:

<div class="sc_team_item_avatar"><?php insurance_ancora_show_layout($post_options['photo']); ?></div>

我想使该图片也成为指向该会员个人资料的超链接。我对PHP相当陌生, 而我尝试的一切都失败了。你能帮我忙吗?我想你需要的是代码的第一部分。如果你需要整个php文件, 请告诉我。


#1


试试:(希望它对你有用)

<div style="cursor: pointer;" onclick="window.location='<?php echo esc_url($post_options['link']); ?>';" class="sc_team_item_avatar"><?php insurance_ancora_show_layout($post_options['photo']); ?></div>

或者检查var是否不为空可能更好

<div style="cursor: pointer;" onclick="window.location='<?php if(!empty($post_options['link'])){ echo esc_url($post_options['link']);} ?>';" class="sc_team_item_avatar"><?php insurance_ancora_show_layout($post_options['photo']); ?></div>

来源:

https://www.srcmini02.com/63675.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37594.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?