You can use wordpress php code plugin. Example look at this: https://wordpress.org/plugins/insert-php-code-snippet/