php 上的超链接
我正在开发一个 WordPress 模板,需要添加一个指向页面顶部卡通气泡的超链接。 据我所知,泡沫是 php。 在哪里插入 href?
<h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
href 应指向 www.ojaivalleynews.com
博客网址为 www.ovnblog.com 如果您想要气泡上的视觉效果。 我已经使用 firebug 进行了检查,但可惜我对 php 的了解不够,无法理解它。
更新
我错过了关于上述问题的第二行代码,并根据此处的建议,对此行进行了更正并且它有效。
<h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
<div id="bubble"><p><a href="http://www.ojaivalleynews.com/" target="_blank"><?php bloginfo('description'); ?></p></div>
I'm working on a WordPress template and need to add a hyperlink to the cartoon bubble at the top of the page. The bubble, as far as I can tell, is php. Where do I insert the href?
<h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
The href should point to www.ojaivalleynews.com
The blog url is www.ovnblog.com if you want a visual on the bubble. I've used firebug to ispect, but alas I don't know enough about php to make sense of it.
Update
I missed the second line of code regarding the above question, and based off of the suggestions here, have made corrections to this line and it works.
<h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
<div id="bubble"><p><a href="http://www.ojaivalleynews.com/" target="_blank"><?php bloginfo('description'); ?></p></div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
只需替换
为
just replace the
with
rashneon,查找以下 HTML(在 header.php 中搜索“bubble”),
将其替换为
@Endlessdeath - 不,令人愉快的是,WordPress 混合了一堆打印的函数和一堆返回值的函数。 所以是的,它确实应该是
- 请参阅默认主题文件
rashneon, look for the following HTML (search header.php for 'bubble')
replace that with
@Endlessdeath - no, delightfully WordPress mixes a bunch of functions which print with a bunch of functions which return values. So yes, it really is supposed to be
<?php bloginfo('url'); ?>
- see the default theme file我想这就是你想要的,但我不能确定......
I think that's what you want, but I can't be sure...
如果你想用另一个 -static- 链接替换它应该是:
if you want to replace this with another -static- link it should be:
在 WordPress 中,bloginfo('url') 为您提供博客主页的 url。 “bloginfo”与“echo get_bloginfo”相同。
如果您博客的主页是 http://www.ojaivalleynews.com,那么它将输出。 否则,如果 http://www.ojaivalleynews.com 与您的博客无关,只需替换为像其他人推荐的静态网址。
如果您是 WordPress 新手并且打算经常使用它,请参阅 http://codex.wordpress .org/
**更新**
更新您的更新,bloginfo('description') 为您提供博客的描述/标题(通常在博客标题下)。 如果您的博客是 http://www.ojaivalleynews.com,则您将在第一个动态输出网址链接并在第二个静态。 如果没有,您将在 http://www.ojaivalleynews.com。
In WordPress, bloginfo('url') gives you the url to your blog's home. "bloginfo" is the same as "echo get_bloginfo".
If your blog's main page is http://www.ojaivalleynews.com, that's what it'll output. Else, if http://www.ojaivalleynews.com has nothing to do with your blog, just replace with the static url like others recommended.
If you're a new to WordPress and you're going to use it a lot, see http://codex.wordpress.org/
** UPDATE **
Updating your update, bloginfo('description') gives you your blog's description/headline (generally under your blog's title). If your blog is http://www.ojaivalleynews.com, you're outputing the url dinamically in the first link and staticly in the second. If not, you're giving your blog's description as text on the link to http://www.ojaivalleynews.com.
您不需要回显函数的返回值吗?
Don't you have to echo the return values of the function?