Title: Using php with Code Snippet
Last modified: May 26, 2022

---

# Using php with Code Snippet

 *  [Frank](https://wordpress.org/support/users/phasar40/)
 * (@phasar40)
 * [4 years ago](https://wordpress.org/support/topic/using-php-with-code-snippet/)
 * I have some code written in php. There are three files. One is just config, another
   is display and the third contains the code needed to get the info for the display
   file
 * So how do I gt this to work? Do I create a snippet using all the code in the 
   display file?
 * I have an online radio station and this code is used to display the “now playing”
   info. It was created before I started using wordpress and I want it to display
   on our main page.
 * I thought I had already got this working but for some reason all my snippets 
   have disappeared. All I’m left with are the demo scripts

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years ago](https://wordpress.org/support/topic/using-php-with-code-snippet/#post-15681884)
 * It sort of depends on how you have things set up, but you could definitely include
   them all in the same file, but you’d need to wrap your display code in a shortcode
   hook. Otherwise, you could add the config and processing code as a PHP snippet,
   and then the HTML as a display snippet.

Viewing 1 replies (of 1 total)

The topic ‘Using php with Code Snippet’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/using-php-with-code-snippet/#post-15681884)
 * Status: not a support question