How to add custom code to your website?

FiboSearch is highly customizable, offering several ways to modify its functionality. While many features can be configured through the FiboSearch settings page, you can extend its capabilities further with custom code. This guide provides you with the proper methods to safely add custom code to your website.

Table of Contents

Adding custom PHP code

Using the functions.php file or the Code Snippets plugin

To add custom PHP code, the best approach is to modify the functions.php file of your theme. It’s recommended to use a child theme for this to prevent losing changes when the theme is updated.

  1. Navigate to /wp-content/themes/<your-theme>/functions.php.
  2. Add your custom code at the end of the file.
Add custom code to functions.php

If you’re not using a child theme or are uncomfortable editing theme files, you can use the Code Snippets plugin as an alternative:

  1. Install and activate the Code Snippets plugin.
  2. Go to Snippets > Add New.
  3. Enter a title for the snippet (optional).
  4. Paste your PHP code into the “Functions (PHP)” tab.
  5. Choose where to execute the code: on the admin panel, the front-end, or both.
  6. Save and activate the snippet.
Add code with the Code Snippets plugin

Adding code to fibosearch.php

Certain FiboSearch features may require you to add custom code to a file called fibosearch.php. This file should be created manually in the root directory of your child theme (next to functions.php).

If you’re not using a child theme or are working with a non-theme builder (such as Oxygen), place the fibosearch.php file directly in the wp-content directory.

Note: Always ensure the file starts with the opening PHP tag (<?php):

Add code to the fibosearch.php file

Modifying wp-config.php

For customizations that require changes to the wp-config.php file, it’s crucial to add your code before the /* That's all, stop editing! Happy publishing. */ line:

Add code to the wp-config.php file

Adding code after this line or in other parts of the file may cause errors or prevent the code from executing properly.

Adding custom CSS

To add custom CSS to your website, there are two options:

Via WordPress Customizer

  1. Navigate to Appearance > Customize > Additional CSS.
  2. Paste your custom CSS code in the provided text box.

Using a plugin

  1. Install a plugin like Simple Custom CSS.
  2. Add your CSS code through the plugin interface.

For further assistance, you can refer to the following tutorial video: How to Easily Add Custom CSS to Your WordPress Site.

By following these guidelines, you can effectively extend FiboSearch with custom code tailored to your needs.