大家好,我正在尝试在 wordpress 摘录的末尾添加一个 readmore 扩展名“...”,该摘录在与“recent post plus”wordpress 小部件内的摘录在同一行上有一个可点击的永久链接
我似乎无法弄清楚为什么它将阅读更多扩展名“...”放在摘录下方的另一行。你可以在我的测试页面底部看到一个问题的例子
它在页面上看起来像这样
摘抄
...
如果可能的话,我希望它像这样显示
摘抄...
这是我认为控制它的小部件的 php 代码,如果我需要按请求发布整个小部件代码,我现在将这里是我认为用于这部分小部件功能的主要代码位是生成带有扩展名的摘录的函数,并将其输出到 php 的新页面,因此非常感谢任何帮助。
// Custom rpwp_excerpt function
function rpwp_excerpt($count){
$permalink = get_permalink($post->ID);
$excerpt = get_the_content();
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $count);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = $excerpt.'<a href="'.$permalink.'">...</a>';
return $excerpt;
}
//output of the excerpt and title to the page
<p>
<a href="<?php the_permalink(); ?>"><?php the_title_limit( 15, ''); ?></a>
<a href="<?php the_permalink(); ?>"><?php echo rpwp_excerpt($instance['characters']);?></a>
</p>