【发布时间】:2012-07-07 23:19:57
【问题描述】:
我想要的是:如果帖子有标题,我想显示它
在wordpress.org codex可以看到以下例子:
<?php the_title( $before, $after, $echo ); ?>
还有这个例子:
<?php the_title('<h3>', '</h3>'); ?>
我想做的是在 href 中添加一个带有 the_permalink 的超链接
<?php the_title('<h3><a href=" the_permalink(); ">', '</a></h3>'); ?>
但这不起作用。
换句话说:如何在显示的代码中编写 the_permalink();?
我也尝试过:
<?php the_title('<h3><a href="' . the_permalink() . '">', '</a></h3>'); ?>
这会导致:
mysite.com/?p=1
我的头衔
【问题讨论】: