How to place PHP code in WordPress page or post
Problem of inserting PHP code into a page is rather very serious one, especially that with new versions of WordPress some old plugins stopped working. WordPress as such offers very useful set of functions for both functionality and content manipulation. The functions are very well documented. For many simple tasks instead of plugin installation it is enough if you use limited set of WordPress functions. For instance page with all posts published on this website (see ALL POSTS DIRECTORY) uses a few WordPress functions to get information about published posts and to link to them automatically. Obviously, it is possible to find some plugin which can list posts, but with simple PHP code inserted in a page in a suitable place this is much better solution, especially in highly customized layout. So, instead many plugins doing simple tasks, it is better to install one plugin like this one: “Allow PHP in Posts and Pages” which is able to wrap any PHP code and safely execute it in a WordPress page or post. Plugin Allow PHP in Posts and Pages uses prepared snippets and instead of PHP code you insert only very simple plugin shortcode which is a snippet representation. Snippet needs to be modified in one place only – in plugin management panel – so all modifications can be instantly visible in all pages and posts where you inserted the plugin shortcode.