I am trying to add php code(2000 lines) to WordPress post manually without using any plugin or third party tool. But I have not been successful in this… If anybody knows how I can do this please feel free to post an answer. So far I have been able to add my php code to WP Page but not WP Post. I will be looking forward to you! Thanks!
2
Answers
I was able to do this by creating a separate .php file in my theme "twentytwentytwo" folder and then I pasted the following code in it...
"<?php /*
Template Name: new Theme
Template Post Type: post */ ?>"
"" ""
By doing this I created a Separate theme for my post. Then simple pasted my php code under the get_header() line.... After this I logged in to my WP admin and clicked on the edit post and in the template dropdown section I found my theme name "new Theme" just selected that and published. Job done!
Use ‘the_content’ filter https://developer.wordpress.org/reference/hooks/the_content/
example :