How to work with code snippets

Code snippets, are simple, small portions of code, that allow you to make some little changes in WPJobBoard. Making those require some basic PHP knowledge, but we prepared the most common snippets for you, you just need simple adjusting. But what you need to know is how to install those snippets on your page.

You can find a full list of our snippets on this page.

You have 3 possible way of doing this:

Add code to functions.php

Each theme has functions.php file located in the main directory, example:

wp-content / themes / your_theme / functions.php

You can access this file via FTP, and edit it using any text editor you have (or like). In edition, just scroll-down at the end of the file, and paste snippet we prepared for you, and click CTLR + S to save changes. When you close text editor, your FTP program may ask you if you want to send the changed file to your server – agree on that.

Now snippet should work. The downside of this method is, that if you will change theme (or update current) you will lose this change, and you will need to add snippet again.

Create a custom plugin (For Advanced Users)

In this method, you need to create a file, looking like this:

<?php
/**
Plugin Name: WPJobBoard - My Snippet
Version: 1.0.0
Author: Your Name
Author URI: http://simpliko.pl/
Plugin URI: http://wpjobboard.net/
Description:  My Custom Snippet
 */

// Place for snippet

Now, you can copy your snippet at the end of the file. Prepare directory with a unique name like “wpjb-my-snippet”. Put your file into this directory (your file can have any name, but we recommend to use “index.php” or copy the name of your directory, so in our example, it will be “wpjb-my-snippet.php”.

Now connect with your server using FTP, and copy the whole directory to wp-content / plugins. Now you should be able to see the new plugin, on plugins list in wp-admin -> Plugins. Activate it, and snippet should work.

Instead of connecting via FTP you can also, put the whole directory into a zip archive than go to wp-admin -> Plugins -> Add New, choose “Upload Plugin” and find your archive on disk. After upload will be done, activate it like in the FTP method.

This method is complicated, but your snippet will work always.

Use 3rd party plugin

This method is easiest, but require the installation of another plugin. Go to this page, and install the plugin.

After installation, just choose wp-admin -> Snippet -> Add New, paste code into Code section, and click “Save changes and active”.

This method is simplest to use but require an additional plugin.

Conclusion

No matter, what option you will choose, snippet should work fine. In case of any trouble, you can contact us via e-mail.

Leave a Reply

Your email address will not be published.