Custom php snippets?

hello.

how hard would be for me to add a php snippet to a homepage, and to an other page that I will add?

asking because my game’‘s devs are thinking about switching our horrible stack to classicPress.

any info would be appreciated.

1 Like

Basically you can. Either with a plugin with your snippet to control where it executed, how, etc OR directly in the page template code I think.

What you could do with WP is doable in CP.

1 Like

I’d want 2 snippets, one for NTM manuals that will do some JSON work and the other for online players in homepage so 2 different snippets in 2 different locations.

You can modify page templates in theme then.

Best way is put functions in functions.php of theme and create templates for such pages where you call such functions.

1 Like

Inserting a php snippet can be done in the following ways:

  • custom plugin
  • mu plugins
  • wordpress theme functions.php

here is a beginner’s video on that: https://youtu.be/HXTclnBfhuA?si=xlJzou_m75t-VQPH

You might want to explore the WordPress codex for its custom functions that you may need. For page specific snippets you can have a look at is_page() – Function | Developer.WordPress.org

sadly my organization is a bit wary if comes to CP and we’re going back and forth but I got most voting members on my side.

1 Like