我想要的是以下内容:如果帖子有 Headers ,我想展示它
在wordpress.org codex中,您可以看到以下示例:
<?php the_title( $before, $after, $echo ); ?>
这个例子:
<?php the_title('<h3>', '</h3>'); ?>
我想要做的是,我在href中添加了带有_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
我的头衔
2 回答
循环内部
the_title()
将回显 Headers . 你可以用这种方式编写它