WordPress 自动将站点 url 添加到 href,但 href 不为空
所以我正在尝试调试一个有点令人困惑的问题。我正在为 Topspin 商店使用 WordPress 插件,该插件使用 colorbox 弹出一个窗口来显示有关商品的更多信息。这是网站:okgo.net/store。在此页面的后端代码中,创建了一个 div 块,其中包含应如下所示的链接:
<a class="topspin-view-item" href="#!/77022">
执行此操作的 php 如下所示:
<a class="topspin-view-item" href="#!/<?php echo $item['id']; ?>">
问题是最后吐出的内容是不是那个。它看起来像这样:
<a class="topspin-view-item" href="http://okgo.net/video-store/#!/89712">
我从 这里的另一篇文章指出,Wordpress 的默认行为是用网站 url 填充空的 href(即 href="")。所以我的猜测是 WordPress 出于某种原因将其解释为空 href?但这似乎也不太正确。
我已经玩过这个了。发生的一件事是,如果我从上面的 PHP 中删除 has,则根本不会输出 siteurl。这当然破坏了我的代码。
有什么想法吗?任何帮助将不胜感激。
So I'm trying to debug a somewhat confusing problem. I'm using a Wordpress plugin for a Topspin store that uses colorbox to popup a window to display more information about an item. Here's the site: okgo.net/store. In the backend code for this page a div block is created containing links that that should look like this:
<a class="topspin-view-item" href="#!/77022">
The php that does that is as follows:
<a class="topspin-view-item" href="#!/<?php echo $item['id']; ?>">
The problem is that what is being spat out at the end is not that. It looks like this:
<a class="topspin-view-item" href="http://okgo.net/video-store/#!/89712">
I've understood from another post on here that the default behavior of Wordpress is to fill empty hrefs (ie href="") with the site url. So my guess is that Wordpress is for some reason interpreting this as an empty href? Except that that doesn't seem quite right either.
I've played around with this a bit. One thing that happens is that if I remove the has from the above PHP the siteurl is not output at all. That of course breaks my code.
Any ideas? Any help would be warmly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们最终为那些可能感兴趣的人解决这个问题的方法是简单地将以下代码行添加到处理提交事件的 jQuery 处理程序中:
也许这会对某人有所帮助......
The way we ended up fixing this for those who may be interested is by simply adding the following line of code to the jQuery handler that dealt with the on submit event:
Perhaps this will be of help to someone...