I basically want to add an embedded form at the end of every blog post just below the main content area (I tried adding in the footer but it gets skipped due to showing up at the very bottom of the page). Where exactly do I put the code in the editor?
I basically want to add an embedded form at the end of every blog post just below the main content area (I tried adding in the footer but it gets skipped due to showing up at the very bottom of the page). Where exactly do I put the code in the editor?
Share Improve this question asked Jun 6, 2018 at 21:34 Uday SarojUday Saroj 111 bronze badge2 Answers
Reset to default 1If you want to modify the content before it is output to the screen, use the_content filter:
add_filter( 'the_content', 'change_the_content' )
function change_the_content($content) {
$content = $content . "your additional content";
return $content;
}
See docs here: https://codex.wordpress/Plugin_API/Filter_Reference/the_content .
You don't, if you want to embed something in a post, you have 2 options:
- oembed: Great for stuff like youtube, and other things, think of embeds, think of things that can be represented as URLs, e.g. copy paste a youtube URL on to a blank line and it turns into a youtube player
- shortcodes: This is how you run PHP code and insert HTML inside a post
- filters: You can append the code via
the_content
filter to your posts when they're rendered. This allows you to add things without modifying the post content
Anything that will let you copy paste a form as is into a post edit screen is going to be a security problem, dramatically increasing the chances of your site becoming hackable