Use of do_shortcode instead of the_content
I finally found a way to change the content of a widget from within a wordpress page – this was important because I want the owners of the site to be able to edit it without getting into trouble.
The way I have done it is to use “echo apply_filters(‘the_content’, $p->post_content);” in my code. To my distress though, having got this to work, I then fell across this page http://kovshenin.com/2011/12/the-content-filter-3720/ which warns against applying the_content filters. It suggests instead to use wpautop and do_shortcode.
I can’t work out how to use those alternatives. Can anyone advise please:
1. is the advice against the use of the_content filters correct; and
2. if so how, instead, do I use the alternative suggested. I have looked in the wordpress codex for advice on do_shortcode but the instructions are not detailed enough for me to understand.
Thanks for any help.
- The topic ‘Use of do_shortcode instead of the_content’ is closed to new replies.