If you don't know how to add PHP code to WordPress posts or pages, I recommend using the following plugin to make PHP snippets as custom shortcodes.