Php 使头像也成为超链接

Php 使头像也成为超链接,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我有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_g

我有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文件,请告诉我。

试试:(希望它能以这种方式为您服务)


它没有。这是我检查时的输出:example.com/team/john/“>感谢您的快速回复。尽管如此:example.com/team/john/”>我认为可能还有另一个技巧,将在片刻后更新,使用window.location onclick尝试,效果如何?现在是一个href,但它没有指向成员页面。只是重新加载当前页面。echo$post_选项['link']已编辑,请检查:)我忘记了echo
<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>
<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>