search

Home  >  Q&A  >  body text

How to add PHP code in WordPress POST without using a plugin

I'm trying to manually add php code (2000 lines) to a WordPress post without using any plugins or 3rd party tools. But I haven't had success with this yet... If anyone 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 the WP Page but not to the WP Post. I'll be looking forward to it! Thanks!

P粉327903045P粉327903045278 days ago509

reply all(1)I'll reply

  • P粉659516906

    P粉6595169062024-02-27 15:39:56

    I could do this by creating a separate .php file in the theme's "twentytwentytwo" folder and pasting the following code into it...

    "

    • Template name: New theme

    • Template Post Type: Post */ ? >”

    "" ""

    By doing this, I create a separate topic for my posts. Then simply pasted my php code below the get_header() line... After that I logged into my WP admin and clicked on edit post and in the template drop down section I found that my theme name "New Theme" was just selected and published. Job done!

    reply
    0
  • Cancelreply