admin管理员组文章数量:1389750
n my WordPress website, I want to show a short text of each blog_post on the custom blog template. I want to show a Read More button with a link to the post at the end so a user can click on that link and view the full post.
But I am always getting the whole post instead of its summary.
Here is my code:
<div class="contentTitle">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div>
<div class="contentText">
<?php
$readmore = '<p><a href="'.get_permalink().'"></a></p>';
echo wp_trim_words( get_the_content(), 3, $readmore ); ?>
</div>
<?php endwhile; ?>
Am I doing any mistake in my code?
本文标签: phpwptrimwords() does not work with my code Am I doing any mistake in my code
版权声明:本文标题:php - wp_trim_words() does not work with my code Am I doing any mistake in my code? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744599606a2614989.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论