admin管理员组

文章数量:1289556

I am using a plugin which shows posts from specific category in a widget.

It has an option to show excerpt and the below code is used for that:

<?php echo $post['excerpt'] ?>

But I want to show full posts instead of excerpt.

I tried the_post, the_content instead of excerpt in the above code but none working.

Can you please let me know what I am doing wrong?

I am using a plugin which shows posts from specific category in a widget.

It has an option to show excerpt and the below code is used for that:

<?php echo $post['excerpt'] ?>

But I want to show full posts instead of excerpt.

I tried the_post, the_content instead of excerpt in the above code but none working.

Can you please let me know what I am doing wrong?

Share Improve this question asked Jun 27, 2021 at 10:17 JituuJituu 314 bronze badges 1
  • 1 We'd really need to see more of your code. What is $post for example and how'd it get there? – Paul G. Commented Jun 27, 2021 at 12:33
Add a comment  | 

1 Answer 1

Reset to default 0

You should use this (because the content saved in the post is unfiltered):

echo apply_filters( 'the_content', $post->post_content );

However, be advised that you should not alter code of plugins or themes that are not created by you. If that plugin is updated, your altered code is probably gone. For themes, you could create a child theme, but for a plugin, you might want to create your own. Creating a simple plugin that creates a widget that displays posts from a category is not too difficult.

本文标签: phpShow full post instead of excerpt