我一直在玩PHP来尝试获取帖子标题以链接到正确的帖子,但现在它不断添加页名。
<h6><a href="<?php the_permalink($this_post->ID); ?>" title="<?php
the_title(); ?>"><?php the_title($this_post->post_title); ?></a></h6>
这是指向页面的链接,因此您可以看到我正确的意思-http://www.city-perks.co.uk/discounts/
尝试此代码
<?php
if ($cmb_listing_layout == '3')
{
sprintf('<h6>%s</h6>', esc_attr($this_post->ID));
}
?>
如果要获得另一个页面,则需要使用get_the_title( $id_page )
函数。