1. Home
  2. Docs
  3. Insert PHP Code Snippet
  4. User Guide
  5. PHP Code Snippets

PHP Code Snippets

In the PHP Code Snippets section, we can see all the available snippets and can create new snippets.

On this page, we can see all the Snippets, shortcode of the snippet, and status of the snippet.

If the snippet is active, you can deactivate it by clicking on the deactivate image in the Action section.

To activate a snippet click on the activate button

You can edit the snippet by clicking on the edit button

To delete the snippet, click on the delete button.

Using the preview button, we can see the preview of the snippet.

To create a new PHP Code Snippet, please click on the button “Add New PHP Code Snippet

Here you can enter the Tracking Name and the PHP code (without the starting and ending PHP tags <?php  ?>).
Now choose the snippet placement method

Snippet Placement Methods

Users can select the desired method for placing snippets on their site. The available options are:

1. Automatic

  • Automatically inserts the snippet based on the selected location.
  • Supports placement in predefined locations in the admin area, frontend

2. Execute on Demand

This feature allows snippets to be executed only when clicked, making it ideal for developers who want to run snippet code manually by clicking the play icon next to the snippet.

3. Short code (Manual)

  • Generates a short code for the snippet, which the user can manually insert into content.
  • Useful for fine-grained control over snippet placement.
  • Users can copy this shortcode and paste it in the location where you want to display the content.

Now click on the Create button and you will get a shortcode.

When you create a new post or page, you can see the snippet in the editor section as given below.

php snippets

Note: To add the snippet code in templates, please follow the link  Can I embed the PHP Snippet into my template file?

Was this article helpful to you? No 51 Yes 37