How to install EverXP JavaScript / PHP libraries to WordPress Tutorial (With or Without a Plugin)
The easiest way to add EverXP Combinations to WordPress is with our official wordpress plugin. This method is more flexible and easier to manage than adding the code directly to your theme. using PHP what makes it SEO Friendly.
Visit your EverXP dashboard and generate your unique API Key, next go to your wordpress dashboard and click on `Settings -> EverXP - API Settings`. Paste the API Key and your account email address.
To add EverXP combinations into your wordpress posts, pages you can use the blue buttons on the right to add custom codes. Endpoint IDs can be found here.
Examples:
The easiest way to add JavaScript to WordPress is with a plugin. This method is more flexible and easier to manage than adding the code directly to your theme.
If you’re not comfortable with coding or want a more user-friendly solution, we recommend using one of the many plugins available for adding JavaScript to WordPress.
For this tutorial, we’ll be using Insert Headers and Footers (WPCode), or you can use any other plugin to implement JS Code on your Wordpress website.
Once the plugin is activated, navigate to Header & Footer in your WordPress dashboard.
You’ll see two boxes labeled Scripts in Header and Scripts in Footer.
Any code you add to these boxes will be inserted into the header or footer of your site. This is where you’ll add your JavaScript.
In order to get started, please copy and paste this code on the footer input
<script src='https://api.everxp.com/assets/js/everxp-1.0.js'></script>
Look for Code Snippets in the admin left sidebar menu and click it to get to the list of snippets.
Next, you have to choose if you want to start a new snippet from scratch or load a snippet from the library.
Regardless of how you choose to get started with the snippet the next step will be to choose a snippet title using the title field.
Now that your snippet is set up and it has a name you can start on the most important part: editing the snippet code.
Before you get started you should get your API Key, and generate a JS combination (details below or you can check our full JS Tutorial)
Key | Type | Optional | Explaination |
---|---|---|---|
api_key | Text | Required | base 64 encode email address:api_key API Key Tutorial |
pattern | Number | Required (only on pattern endpoint) | Patterns Ids list |
quote | Text | Required (only on quote endpoint) | Quotes Categories list |
time | Number | Required (only on date & time endpoint) | Date & Time Ids list |
lang | Text | Required | Languages list |
style | Number | Optional | Writing Styles list |
voice | Number | Optional | Writing Voices list |
pull | Number | Optional | Pull Methods options |
freshness | Number | Optional | Freshness levels options |
min_l | Number | Optional | Minimum number of characters |
max_l | Number | Optional | Maximum number of characters |
div | Text | Optional | Returns result as text inside div id otherwise returned as json response |
user_identifier | Text | Optional | Any kind of parameter to identify your customer (IP, User ID, Email, Username, or First and Last name) Example: [email protected]. |
Pull more than 1,000,000 patterns combinations, to any place on your site
<script> xp_pattern({ 'api_key': '_YOUR_API_KEY_', 'pattern': 1, 'lang': 'en', 'style': '', // Optional 'pull': '', // Optional 'freshness': '', // Optional 'voice': '', // Optional 'div': 'selected-div-id', // Optional 'min_l': 0, // Optional 'max_l': 9999 // Optional }); </script>
Pull more than 1,000,000 quotes combinations, to any place on your site
<script> xp_quote({ 'api_key': '_YOUR_API_KEY_', 'quote': 1, 'lang': 'en', 'style': '', // Optional 'pull': '', // Optional 'freshness': '', // Optional 'voice': '', // Optional 'div': 'selected-div-id', // Optional 'min_l': 0, // Optional 'max_l': 9999 // Optional }); </script>
Pull more than 1,000,000 date & time combinations, to any place on your site
<script> xp_time({ 'api_key': '_YOUR_API_KEY_', 'time': 1, 'lang': 'en', 'style': '', // Optional 'pull': '', // Optional 'freshness': '', // Optional 'voice': '', // Optional 'div': 'selected-div-id', // Optional 'min_l': 0, // Optional 'max_l': 9999 // Optional }); </script>
After you’re done creating your combination with the setting up your snippet code or if you just want to test it you should choose how you want to use it. The 2 main options are: as a shortcode (default) or Auto Insert.
The Auto Insert option provides a list of locations where your snippet can be automatically inserted and executed. These are major areas of your site where snippets will be added but, don’t worry, you can choose more specific output options in the Conditional Logic section detailed a bit lower.
Some locations, like Before/After Paragraph or Before/After Post will also ask you to input a number after or before which to add the snippet.
The Conditional Logic box allows you to create powerful rules to either show or hide the snippet based on a set of rules. You can create groups of conditions that will all have to be true for the snippet to be show/hidden but also “OR” rules to add multiple groups of such combination of rules.
Write a simple div tag with id (as you chosed on the "div" parameter in the JS code)
To get started, visit our REST API Documentation page, and scroll down to select the API Endpoint you would like to use.
Next, choose from the code request example PHP.
Paste the PHP code into the Code Snippet using Headers and Footers (WPCode) Plugin.
Follow the code in the screenshot to Json Decode, and print the combination properly.
Generate a shortcode code and copy!
Lastely, go to your Wordpress site editor.
It can be any type of editor (lagacy, Theme editor, or Elementor like in the example) and simply paste the shortcode.
To finish the process you can add custom html as needed!
That's it!
This way you can embed on your Wordpress site, unlimited amount of combinations.
You can set combinations on multiple pages, or specific pages as you wish.
Facing an error? Error codes list