1.Introduction #

1.1.What is a snippet? #

The snippet is a programming term for a small region of re-usable source code, machine code, or text. Ordinarily, these are formally defined operative units to incorporate into larger programming modules. Snippet management is a feature of some text editors, program source code editors, IDEs, and related software. It allows the user to avoid repetitive typing in the course of routine edit operations.

1.2.Purpose of the Plugin #

This plugin lets you build a library with snippets of HTML, PHP code or reoccurring text that you often use in your posts and pages. You can use predefined variables to replace parts of the snippet on insert. All snippets are available in the post editor via a button in the Visual mode. The snippet can be inserted as defined, or as a shortcode to keep flexibility for updating the snippet. PHP code is supported for snippets inserted as shortcodes. A block is also available in the Gutenberg Block Editor to add the snippet via selecting Snippet Title from the list.

2.Features #

  • The admin can add a PHP Code in the snippet.
  • The admin can add a JS Code in the snippet.
  • The admin can add a CSS Code in the snippet.
  • The admin can add a Custom Code in the snippet.
  • The admin can make a Shortcode for the snippet.
  • The admin can create the groups for the snippets.
  • CSS Code snippets allow the user to apply it in the Front-End or in the Admin.
  • The Admin has multiple areas to apply the CSS Code snippets in the Front-End.
  • The Admin can Import and Export snippets.
  • REST API is also available in this plugin.
  • The Admin can Active and Inactive a snippet.
  • Gutenberg Block for the Post Snippet plugin.

3.Installation Guide #

  • After purchasing and downloading the Post Snippet plugin zip file, navigate to the  WordPress Admin Dashboard → Plugins → Add New.

 

  • Click on the Upload Plugin button on the top left corner of your screen.

  • Next, click the Choose file button in the box that appears below.
  • Select the zip file that you have downloaded.
  • Click on the Install Now button.

  • After installing the plugin, click on the Activate Plugin button to activate the plugin.

  • After installing the plugin, you have to enter your plugin license key.
  • To get the license key, visit the plugin website.
  • Click on the Pricing button.
  • Select a plan.

  • Click on the Purchase button.
  • Provide your Card Details.
  • Click on the Review Order button.

  • After completing the order, the user will receive the invoice and license key on the email.

  • After installing the plugin, enter your plugin license key and click on Activate.

  •  

 

4.Getting Started #

  • After activating the plugin, you can see Post Snippets in the WordPress Admin Dashboard → Post Snippets.

  • Now, click on All Snippets.
  • In the All snippet section, all the snippets added by the Admin are displayed in the table.
  • It also contains the button Add New to add a new snippet.
  • The admin can bulk Enable and Disable a snippet.
  • Filter with Group and Status.
  • Upload and Download the selected snippet from the cloud.

4.1.Groups #

  • In order to categorize the snippets in the form of groups, navigate to the  WordPress Admin Dashboard → Post Snippets → Groups. 

  • Now, you are in the Groups section.
  • Here the user can add a new group.
  • All the groups are also displayed in this section in the form of table.
  • A default group is automatically added with a name ‘ungrouped’, this group cannot be edited or deleted.

4.1.1.Add a Group #

  • In the Add New Group section, type in Name, Slug and Description of the group.
  • Click on the Add Group button.

  • The added group will be displayed in the Groups table.

  • Hover over a group and you will see two options Edit and Delete.

4.1.2.Edit a Group #

  • Click on the Edit button.
  • The Group details will be displayed in the section above the groups table.

  • Click on the Edit Group button.
  • The edited group will be displayed in the group table.

4.1.3.Delete a Group #

  • To delete a group, hover over the group that you want to delete.
  • Click on the Delete button.
  • The Group will be deleted.

4.2.Add Custom Code #

  • In the All Snippets section, click on the Add New button to add a new snippet.

  • Or navigate to the WordPress Admin Dashboard → Post Snippets → Add Custom Code. 

  • The add new snippet page will open.

4.2.1.Add a Snippet Title #

  • Enter a Snippet Title that will help you identify the snippet in the All Snippet page.

4.2.2.Code Editor #

  • This is the block of Text, HTML or PHP code which is inserted in the post or used as a shortcode. 
  • Type in your code or text in the Code Editor.
  • If you have entered predefined variables you can reference them from the snippet by enclosing them in {} brackets in the Code Editor.

 

4.2.3.Add Variables #

  • If you want to enter predefined variables, you can reference them from the Variables field.
  • The Variable field is a comma separated list of custom variables you can reference in your snippet. A variable can also be assigned a default value that will be used in the insert window by using the equal sign, variable=default.

Note: Assign your variable in “” (quotes) in code editor, for example: $variable = “{yourVariable}”. 

4.2.4.Make a Shortcode #

  • The Shortcode checkbox is the identifier, and it is required to make the appearance of the snippets on the page/post.
  • When enabling the shortcode checkbox, the snippet is no longer inserted directly but instead inserted as a shortcode in the post editor window. The advantage of this is that you can insert a block of text or code in many places on the site, and update the content from one single place.
  • It can still be added directly in the Block Editor if this option is not selected, provided that its status is Active.
  • The name to use the short-code is the same as the snippet title (spaces are not allowed). When inserting a short-code snippet, the short-code and not the content will be inserted in the post.
  • If you enclose the short-code in your posts, you can access the enclosed content by using the variable {content} in your snippet. The {content} variable is reserved, so don’t use it in the variables field.

  • The Shortcode can be found in the Actions panel located on the right hand side of the page. 
  • It is displayed after Saving the snippet. 

 

4.2.5.Make a PHP Code #

  • Snippets can optionally also be evaluated as PHP Code by enabling the PHP checkbox
  • Any snippet variables will be replaced before the snippet is evaluated as PHP code. 
  • Also note that a PHP snippet doesn’t need to be wrapped in <?php  ?>.

  • After clicking on the PHP Code checkbox, the code will be automatically wrapped in <?php ?> in the Code Editor.

4.2.6.WPTexturize #

  • Before the shortcode is outputted, it can optionally be formatted with wptexturize to transform quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.
  • Click on the WPTexturize checkbox to enable it.

 

4.2.7.Actions Panel #

  • The Actions panel is located on the right hand side of the page.
  • It contains the Download Snippet button. This button allows you to download the previous snippet version from the cloud. 
  • It contains the Upload Snippet button. This button allows you to upload the current snippet version on the cloud and update the previous snippet. 
  • You can also duplicate the snippet. Click on the Duplicate Snippet button if you want to duplicate it.
  • Shortcode of the snippet can be found in this panel if the shortcode checkbox is marked.
  • You can also change the status of your current snippet from the Status dropdown menu. Change it between Active and InActive.

4.2.8.Groups #

  • If you want to add your snippet in a group, select a group from the Groups panel.

4.2.9.Add a Description #

  • You can add an optional description for the Snippet. 
  • Type in the description for the snippet in the Description.

  • After setting the snippet, click on the Save button to save the snippet.
  • Your snippet will be displayed in the snippet table in the All Snippets section.

4.2.10.Edit a Snippet #

  • To edit a snippet, navigate to the WordPress Admin Dashboard → Post Snippets → All Snippets.
  • Hover over the snippet that you want to edit.
  • Click on the Edit button.

  • Edit snippet contains the same layout as the Add Snippet section.

4.3.Displaying Snippet on the Page using the Gutenberg Editor #

  • After setting up your snippet, you can add the snippet on the Page or Post using the Post Snippets block. 
  • Go to the Page or Post editor.
  • Add a new Page or Post or edit the current.
  • Click on the Add new block button.
  • Type in Post Snippets in the search bar.
  • Click on the Post Snippet in the block window.

  • Your Post Snippet block will be added.
  • Go to the Select Snippet drop down menu and select the snippet that you want to add on the Page or Post.

  • If your snippet contains predefined variables, it will display the variable fields with it.

4.3.1.Add Snippet Using a Shortcode #

  • To add a snippet using a shortcode, enable the shortcode checkbox in your snippet.
  • Copy the shortcode from the Actions panel in the snippet.
  • Add a shortcode block in the Post or Page editor. 
  • Paste the shortcode.

4.3.2.Add Snippet Using Classic Editor #

  • If the Admin is using the Classic Editor, after setting up the Post Snippet, a Post Snippet Insert button will be enabled in the page and post editor.
  • This allows you to insert the snippets in the page.

  • Click on the Post Snippets button.
  • A Post Snippet window will appear.
  • This Post Snippet window contains all your available PHP snippets.
  • Each snippet has its own snippet tab.

  • If your snippet contains variables, then you can insert values for these variables in this tab before inserting the snippet.

  • Click on the Insert button to insert the snippet.
  • Your snippet shortcode will be added.

4.3.3.Impact on Front-End #

  • Go to your website.
  • Go to your Post Snippet page.
  • Your shortcode and Custom PHP Code snippet is displayed.

4.4.Add Custom CSS #

  • To add a Custom CSS snippet, navigate to the WordPress Admin Dashboard → Post Snippets → Add Custom CSS.

  • The add new snippet page will open.

4.4.1.Add a Snippet Title #

  • Enter a Snippet Title that will help you identify the snippet in the All Snippet page.

4.4.2.Code Editor #

  • This is the block of CSS code which is applied on the front end or in the admin . 
  • Type in your CSS code without the <style></style> tags as they are already placed in the Code Editor.

 

4.4.3.Actions Panel #

  • The Actions panel is located on the right hand side of the page.
  • It contains the Download Snippet button. This button allows you to download the previous snippet version from the cloud. 
  • It contains the Upload Snippet button. This button allows you to upload the current snippet version on the cloud and update the previous snippet. 
  • You can also duplicate the snippet. Click on the Duplicate Snippet button if you want to duplicate it.
  • You can also change the status of your current snippet from the Status dropdown menu. Change it between Active and InActive.

4.4.4.Options Panel #

  • This section lets you choose where the CSS code should be applied in Site.
  • Where In Site options:
    • In Front End – The CSS snippet will only be applied on the frontend.
      • When you select this option, it will enable Apply Only on These URLs and Preview section.
  • In Admin – The CSS snippet will only be applied on the Admin Pages of the site.

4.4.5.Groups #

  • If you want to add your snippet in a group, select a group from the Groups panel.

4.4.6.Add a Description #

  • You can add an optional description for the Snippet. 
  • Type in the description for the snippet in the Description.

4.4.7.Apply CSS Only On These URLs #

Note: This section is enabled when the In Front-End option is selected from the Where in Site options panel.

  • The admin can select the option from the drop down menu.
  • All Website – CSS will be applied to all of the Front End.
  • Home Page –  CSS will be applied only on the homepage.
  • All Pages – CSS will be applied on all the front end of all the pages.
  • All Posts – CSS will be applied to all the posts.
  • Specific Page/Post – Choose Specific Page or Post in the select box right after it and click on the Add button.

4.4.8.Preview #

  • This section is enabled when the In Front-End option is selected from the Where in Site options panel.
  • This section will provide the Full URL of the page to preview on which the changes have been made.

  • After setting up your snippet, click on the Save button.

4.4.9.Impact on Front-End #

  • CSS applied to Admin.
  • The background color of the WP Admin is changed.

  • CSS applied to the Front-End.

4.5.Add Custom JS #

  • To add a Custom JS code snippet, navigate to the WordPress Admin Dashboard → Post Snippets → Add Custom JS.

  • The add new snippet page will open.

4.5.1.Add a Snippet Title #

  • Enter a Snippet Title that will help you identify the snippet in the All Snippet page.

4.5.2.Code Editor #

  • This is the block of JS code which is applied on the front end or in the admin . 
  • Type in your JS code without the <script></script> tags as they are already placed in the Code Editor.

4.5.3.Actions Panel #

  • The Actions panel is located on the right hand side of the page.
  • It contains the Download Snippet button. This button allows you to download the previous snippet version from the cloud. 
  • It contains the Upload Snippet button. This button allows you to upload the current snippet version on the cloud and update the previous snippet. 
  • You can also duplicate the snippet. Click on the Duplicate Snippet button if you want to duplicate it.
  • You can also change the status of your current snippet from the Status dropdown menu. Change it between Active and InActive.

4.5.4.Options Panel #

  • This section lets you choose where the JS code should be applied on Page and in Site.
  • Where On Page options:
    • Header: Lets you apply JS on the header of the page.
    • Footer: Lets you apply JS on the footer of the page.
  • Where In Site options:
    • In Front End – The CSS snippet will only be applied on the frontend.
      • When you select this option, it will enable Apply Only on These URLs and Preview section.
  • In Admin – The CSS snippet will only be applied on the Admin Pages of the site.

4.5.5.Groups #

  • If you want to add your snippet in a group, select a group from the Groups panel.

4.5.6.Add a Description #

  • You can add an optional description for the Snippet. 
  • Type in the description for the snippet in the Description.

4.5.7.Apply CSS Only On These URLs #

Note: This section is enabled when the In Front-End option is selected from the Where in Site options panel.

  • The admin can select the option from the drop down menu.
    • All Website – JS will be applied to all of the Front End.
    • Home Page –  JS will be applied only on the homepage.
    • All Pages – JS will be applied on all the front end of all the pages.
    • All Posts – JS will be applied to all the posts.
  • Specific Page/Post – Choose Specific Page or Post in the select box right after it and click on the Add button.

4.5.8.Preview #

  • This section is enabled when the In Front-End option is selected from the Where in Site options panel.
  • This section will provide the Full URL of the page to preview on which the changes have been made.

4.5.9.Impact on Front-End #

  • JS applied in Header in the Front-End.

4.6.Upload Selected Snippet #

  • To upload the snippet on the cloud, select a snippet from the All Snippets table.
  • Click on the Upload Selected button.

  • A confirmation message will be displayed, click on the Upload button.
  • The snippet will be uploaded successfully.

4.6.1.Download Selected Snippet #

  • To download the snippet from the cloud, select a snippet from the All Snippets table.
  • Click on the Download Selected button.

  • A confirmation message will be displayed. If you want to replace the selected snippet from the cloud then click on the Download button.
  • The snippet will be downloaded.

4.6.2.Delete Snippet #

  • To delete a snippet, hover over the snippet that you want to delete in the All Snippets section.
  • Click on the Delete button to delete the snippet.

4.6.3.Activate/Deactivate Snippet #

  • If the Admin wants to deactivate the snippet, hover over the snippet.
  • Click on the Deactivate button to deactivate the snippet.

  • The snippet is now InActive.

  • To activate the snippet, hover over the deactivated snippet.
  • Click on the Activate button to activate the snippet.

  • Snippet is activated.

4.6.4.Bulk Actions #

  • The Admin can Enable and Disable multiple snippets using the Bulk Actions.
  • Select multiple snippets.
  • Go to the Bulk Actions drop down menu.
  • Select Enable or Disable option.
  • Click on the Apply button.

4.6.5.Filter Snippets #

  • Now, the Admin can filter out snippets.
  • Select the Group and Status from the drop down menu.

  • Click on the Filter button.

  • The snippets will be displayed.

4.7.REST API #

  • Post Snippet’s REST API endpoints allow the developers to Create, Update, Delete and Retrieve the snippet.
  • Navigate to the WordPress Admin Dashboard → Post Snippets → REST API.

  • In the Post Snippets REST API settings, you will get the following settings.

4.7.1.Enable Post Snippet #

  • To enable the post snippet REST API, click on the Enable Post Rest API checkbox.

4.7.2.Generate a Post Snippets Token #

  • Next you have to generate a token for your Rest API snippet.
  • Click on the Generate Token button.
  • Each time you click on the generate token button, it will create a unique token.

4.7.3.Create a Snippet #

  • Now scroll down to the Create Snippet.
  • Enter an endpoint title in the Create Snippet field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Now, click on the Save Changes button.

  • After saving the settings, REST API URL will be displayed under the Create Snippet field.

    • Here, you have to use the following URI parameters and replace the following parameters.
      • {token} : replace with your 16 digit generated token.
      • {snippet-title}: replace with a new title.
      • {var}: use 0 for empty or enter comma separated values like, username,email etc.
      • {shortcode} : use 1 for enable and 0 for disable.
      • {php} : use 1 to make it php or 0 for empty.
      • {wptexturize} :  use 1 to enable wptexturize or 0 to disable.
      • {snippet-code} : write simple/plain text, HTML, PHP etc.
      • {snippet-description} : enter a short description for your snippet.
    • After replacing the parameters with new URI parameters, the URL will look like this:
  • https://wordpress-444586-2318562.cloudwaysapps.com/wp-json/post-snippets/restapiSnippet/A2DjNM62Igvkr4AM/newSnippet/fname,lname/0/1/0/snippet?snippet_code=$fname = {fname}; $lname = {lname}; echo $fname; echo $lname;&description=this is the rest api snippet
  • Now, go to your browser search tab and paste the URI.
  • Or go to the Postman, paste the URI in the Enter request URL tab.
  • Click on the Send button.
  • Your response result will be successful.

  • Your Snippet will be successfully created.
  • Go to the All Snippets section to check your newly created snippet.

  • Open your newly created snippet.

4.7.4.Impact on Front-End #

  • To add the newly created Rest API snippet on the page, go to the Page Editor.
  • Add a Post Snippet block.
  • Select the new REST API  snippet from the drop down menu and save the page.
  • Go to the website.
  • Go to the page where you have added the snippet.

4.7.5.Update a Snippet #

  • To update your existing snippet in Post Snippets Rest API Settings, enter the Snippet Endpoint Title in the Update Snippet field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Click on the Save Changes button.
  • You will get the URL under the Update Snippet field.

    • Here, you have to use the following URI parameters and replace the following parameters same as in the Create Snippet.
      • {token} : replace with your 16 digit generated token.
      • {snippet-title}: replace with a new title.
      • {var}: use 0 for empty or enter comma separated values like, username,email etc.
      • {shortcode} : use 1 for enable and 0 for disable.
      • {php} : use 1 to make it php or 0 for empty.
      • {wptexturize} :  use 1 to enable wptexturize or 0 to disable.
      • {snippet-code} : write simple/plain text, HTML, PHP etc.
      • {snippet-description} : enter a short description for your snippet.
    • After replacing the parameters with new URI parameters, the URL will look like this:
  • https://wordpress-444586-2318562.cloudwaysapps.com/wp-json/post-snippets/newSnippet/A2DjNM62Igvkr4AM/newSnippet/fname/0/1/0/snippet?snippet_code=$fname = {fname}; echo $fname; &description=this rest api snippet is Updated
  • Now, go to your browser search tab and paste the URL.
  • Or go to the Postman, paste the URL in the Enter request URL tab.
  • Click on the Send button.
  • Your Snippet will be updated.

  • Go to the All Snippets section to check your updated snippet.

  • Open your updated snippet.

4.7.6.Get a particular Snippets #

  • If the Admin wants to get a particular snippet then first click on the Generate Token button to generate the new token.
  • After generating the token, enter the endpoint title for example: getsnippet, in the Get a Particular Snippet field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Click on the Save Changes button.
  • After saving the changes, you will get the endpoint URL under the Get a Particular Snippet field.

4.7.7.Get all Snippets #

  • If the Admin wants to get all the snippets, type in for example: get-all-snippet as the endpoint title, in the Get All Snippets field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Click on the Generate Token button to generate the new token.
  • Click on the Save Changes button.
  • After saving the changes, you will get an endpoint URL under Get all Snippets field.

4.7.8.Delete a particular Snippet #

  • Admin can delete a particular snippet from these Settings.
  • First generate a new token by clicking on the Generate Token button.
  • Next, enter an endpoint title for example: deleteSnippet in the Delete a particular Snippet field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Now, click on the Save Changes button.
  • After saving the changes, you will get the URL under the Delete a particular Snippet field.

  • Your snippet is deleted from the All Snippets section.

4.7.9.Delete multiple Snippets #

  • Admin can delete multiple snippets from these Settings.
  • First generate a new token by clicking on the Generate Token button.
  • Next, enter an endpoint title for example: deleteMultiple in the Delete multiple Snippets field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Now, click on the Save Changes button.
  • After saving the changes, you will get the URL under the Delete multiple Snippets field.

  • The new URLhttps://wordpress-444586-2318562.cloudwaysapps.com/wp-json/post-snippets/deleteMultiple/E18LwcJkefl195va/MySnippet,PHPSnippet
  • Paste the URL in the browser or in postman.
  • The snippets will be deleted successfully.

  • Your snippets are deleted from the All Snippets section.

4.8.Import/Export Snippets #

  • The Admin can Import/Export Snippets from one website to another website.
  • Navigate to the WordPress Admin Dashboard → Post Snippets → Import/Export.

  • Now you are in the Import/Export section.

4.8.1.Export Snippets #

  • To export all the snippets from the website for backup or import it on another website, click on the Export Snippet button from the Export section.

  • When you click on the Export Snippets button, the post-snippets-export.zip file will start downloading.

4.8.2.Import Snippets #

  • To import the post-snippets-export.zip file in another website, navigate to the Import section in Import/Export.
  • Click on the Choose File button to choose a file from the storage.

  • Select the post-snippet-export.zip file.
  • After selecting the zip file, click on the Import Snippets button.

  • Your snippets will be successfully uploaded.

  • Go to your All Snippets section.
  • Your Imported Snippets will be displayed here.

4.9.Options #

  • Navigate to the WordPress Admin Dashboard → Post Snippets → Options.

  • In the Options, there are two sections, General and Duplicate Snippets.

4.9.1.General #

  • Complete Uninstall deletes all the snippets, snippet data and plugin settings when the admin deletes the plugin.
  • To enable Complete Uninstall, click on the Complete Uninstall checkbox.
  • Click on the Save Changes button to save the changes.

4.9.2.Duplicate Snippets #

  • Through this option, the admin can restrict the duplicate snippets while importing snippets from another site.
  • If the Admin wants to allow the duplicate snippets while importing the snippets from the file then select Allow Duplicate.
  • If the Admin wants to replace the existing snippets with the newly imported snippets of the same name then select Replace Duplicate.
  • If the Admin doesn’t want to import any duplicate snippet and leave the existing snippets unchanged then select Do not Import Duplicate.
  • Click on the Save Changes button to save the changes.

5.Advanced (For Developers) #

You can add constants to wp-config.php or the theme’s functions.php file to control some aspects of the plugin. Available constants to set are:

 // Allow users with edit_posts capability access to the Post Snippets admin.

define(‘POST_SNIPPETS_ALLOW_EDIT_POSTS’, true);

// Disable PHP Execution in snippets and removes the options from admin.

define(‘POST_SNIPPETS_DISABLE_PHP’, true);

You can retrieve a Post Snippet directly from PHP, in a theme, for instance, by using the PostSnippets::getSnippet() method.

5.1.Usage #

<?php $my_snippet = PostSnippets::getSnippet( $snippet_name, $snippet_vars ); ?>

5.2.Parameters #

$snippet_name

(string) (required) The name of the snippet to retrieve.

 

$snippet_vars

(string) The variables to pass to the snippet, formatted as a query string.

Example

// Use query string for variables

$mySnippet = PostSnippets::getSnippet(‘internal-link’, ‘title=Awesome&url=2011/02/awesome/’);

echo $mySnippet;

// Use array for variables

$mySnippet = PostSnippets::getSnippet(‘internal-link’, array(‘title’ => ‘Awesome’, ‘url’ => ‘2011/02/awesome/’);

echo $mySnippet;

6.Filters #

The following filters are available for hooking into the plugin:

  • post_snippets_import   serialized array   Modify snippets and related data before the imported file populates the snippets.
  • post_snippets_export   serialized array   Modify snippets and related data before the export file is created.
  • post_snippets_snippets_list   array   Modify the array of snippets that are used as the snippet list for the jQuery UI dialog in the edit post screen.

7.Examples #

// Filter Exported Snippets

function ps_export( $snippets )

{

  $snippets = unserialize( $snippets );

  foreach ( $snippets as &$snippet ) {

    // Do something here. Example below search and replaces in snippets

    $snippet[‘snippet’] = str_replace(‘search’,’replace’, $snippet[‘snippet’]);

  }

  return serialize( $snippets );

}

add_filter( ‘post_snippets_export’, ‘ps_export’ );

 

Post_snippets_import

 

// Filter Imported Snippets

function ps_import( $snippets )

{

  $snippets = unserialize( $snippets );

  foreach ( $snippets as &$snippet ) {

    // Do something here. Example below search and replaces in variables

    $snippet[‘vars’] = str_replace(‘search’, ‘replace’, $snippet[‘vars’]);

  }

  return serialize( $snippets );

}

add_filter( ‘post_snippets_import’, ‘ps_import’ );

Help Guide Powered by Documentor
Suggest Edit
Scroll to Top