Site logo is not clickable

时间:2015-07-29 作者:Adnan Khan

我正在使用图像作为我的网站徽标,并且图像在网站上显示良好。然而,当图像位于“a”标记内时,它是不可点击的。这是我的代码:

<div class="site-branding">
   <a href="<?php echo bloginfo(\'url\'); ?>">
      <img class="site-logo img-responsive" src="<?php echo bloginfo(\'url\'); ?>/wp-content/uploads/2015/07/logo-height-150.png" />
   </a>
   <img class="description-n-landscape img-responsive" src="<?php echo bloginfo(\'url\'); ?>/wp-content/uploads/2015/07/description-n-landscape.png">

</div>

4 个回复
SO网友:Sereyboth Yorn

你能试试这个代码吗?因为bloginfo() does already echo, 您需要删除echo.

<div class="site-branding">
   <a href="<?php bloginfo(\'url\'); ?>">
      <img class="site-logo img-responsive" src="<?php bloginfo(\'url\'); ?>/wp-content/uploads/2015/07/logo-height-150.png" />
   </a>
   <img class="description-n-landscape img-responsive" src="<?php bloginfo(\'url\'); ?>/wp-content/uploads/2015/07/description-n-landscape.png" />

</div>

SO网友:krillebimbim

You can use the home_url() function for your href and don\'t forget to sanitize the URL, when putting it into tag attributes like href, with esc_url().

<?php echo esc_url( home_url( \'/\' ) ); ?>
SO网友:Tejas

因为bloginfo() does already echo, 您需要删除echo 从您发布的代码片段中<?php bloginfo(\'url\'); ?>.

SO网友:Sourav Mukhopadhyay

只要换一下

<a href="<?php echo bloginfo(\'url\'); ?>">

<a href="<?php echo home_url(); ?>">
仅此而已。我相信这会奏效的。

结束

相关推荐

无法使用BAW登录注销插件添加‘LoginLogout’链接

我安装并激活了“BAW登录/注销”插件,在屏幕上显示登录或注销链接。但这对我不起作用。有人能帮我吗我遵循的步骤是:1)安装并激活“BAW Login/logout”插件2)在菜单面板中,我选择“Login/logout”值并单击“Add to Menu”(添加到菜单)3)将“Login/logout”(登录/注销)选项添加到菜单结构中4)我保存了菜单5)我刷新了网站。但找不到“Login”或“Logout”链接