1. Home
  2. Insert PHP Code Snippet
  3. FAQ
  4. How can I use the PHP snippet in my wordpress site?

How can I use the PHP snippet in my wordpress site?

First install the “Insert PHP Code Snippet” plugin in your wordpress site using the instructions in http://help.xyzscripts.com/docs/insert-php-code-snippet/installation/

Now go to the “XYZ PHP Code > PHPCode Snippets” section

php-snippet

Click the “Add new PHP Code snippet” button.

add-php-snippet

Here enter the “Tracking name”, “PHP code” and click the submit button.

Please note that don’t use the starting and closing php tag (<?php ?>)in the code.

add-php-snippet-2

The snippet is now ready to use and you can see the shortcode of the snippet.

add-php-snippet-3

Now when creating a new post/page, you can add the shortcode directly in the post content.

php-snippet-2

Also you can see all your snippets in the dropdown in the editor with name “PHP” as show below.

php-snippet-3

Here we can see all our snippets with the “Tracking Name” and select one. Then it will place the shortcode in the post.

php-snippet-4

Now update your post and the php code will run in your post.

 

Was this article helpful to you? Yes 2 No 1