Knowledge Base
  1. Home
  2. Knowledge Base
  3. Advanced Topics
  4. Using code snippets to modify functionality

Using code snippets to modify functionality

Our products feature a concise set of options and settings for the most common use cases and functionality requirements.

To go beyond this you can alter the behavior of the product using the inbuilt hooks, actions and filters from the WordPress plugin API.

We have a library of code snippets and examples available on the HeroThemes github page, in the HeroThemes code snippets repository.

The support for these snippets is limited to the guidance below, please do not contact HeroThemes support for assistance as the use of these snippets are considered product customizations.

If you require support for customization of a product, please contact a service such as Codeable or WP Kraken, who have experience customizing and integrating products for our customers.

How to use the code snippets library

There are two ways to use the code – either as a plugin, or by appending and modifying the example code to your (child) theme’s functions.php file.

Using the code snippets library as a plugin

This is  the simplest method, but also least flexible and efficient.

Goto the HeroThemes Code Snippets project homepage and click on the Clone or download button. Select Download ZIP. The latest stable release of the plugin will be downloaded.

You can then upload the .zip file from Plugins > Add New > Upload. Once installed and activated, you can choose the active modules from Code Snippet Settings and selecting the snippets you wish to activate.

 

Using the code snippets library in your theme

This is the recommended way to implement the code snippets, as you can choose and customize the code more effectively.

It is recommend if you are making any styling or coding modifications, this should be done with a child theme to ensure any modifications endure through theme update. You can read more about child themes in the WordPress codex.

Once you have created/uploaded your child theme, modify the theme’s functions.php file and append the chosen code snippet at the end. Modify the operation to suit your requirements.

Was this article helpful?
Related Articles