There are several ways to integrate Locadapt with your WordPress site. We’ll cover three methods, from easiest to most advanced:
Method 1: Using a Plugin (Recommended for Beginners)
This method is the easiest and doesn’t require any coding knowledge.
Install Plugin
Install and activate a plugin like “Insert Headers and Footers” from the WordPress plugin directory.
Access Plugin Settings
Go to Settings > Insert Headers and Footers in your WordPress dashboard.
Add Locadapt Code
In the “Scripts in Header” section, paste the following code: < link rel = "stylesheet" href = "https://cdn.locadapt.com/locadapt.min.css" />
< script
src = "https://cdn.locadapt.com/locadapt.min.js"
data-project-id = "YOUR_PROJECT_ID"
></ script >
Remember to replace YOUR_PROJECT_ID with the actual project ID provided in the configuration page for your Locadapt project.
Save Changes
Click the “Save” button to apply your changes.
Method 2: Using the Theme Customizer
This method is suitable if you’re comfortable with basic WordPress customization.
Access Theme Customizer
Go to Appearance > Customize in your WordPress dashboard.
Add CSS
Navigate to Additional CSS and add the following: @import url ( 'https://cdn.locadapt.com/locadapt.min.css' );
Add JavaScript
Go to Appearance > Theme File Editor and open header.php.
Add the following code just before the closing </head> tag: < script
src = "https://cdn.locadapt.com/locadapt.min.js"
data-project-id = "YOUR_PROJECT_ID"
></ script >
Save Changes
Click “Publish” in the Theme Customizer and “Update File” in the Theme Editor.
Method 3: Using a Child Theme
This method is for advanced users comfortable with WordPress development.
Create Child Theme
Create a child theme if you haven’t already. This preserves your changes during theme updates.
Edit functions.php
In your child theme’s functions.php, add the following code: function enqueue_locadapt () {
wp_enqueue_style ( 'locadapt-css' , 'https://cdn.locadapt.com/locadapt.min.css' );
wp_enqueue_script ( 'locadapt-js' , 'https://cdn.locadapt.com/locadapt.min.js' , array (), null , false );
wp_add_inline_script ( 'locadapt-js' , 'document.currentScript.setAttribute("data-project-id", "YOUR_PROJECT_ID");' );
}
add_action ( 'wp_enqueue_scripts' , 'enqueue_locadapt' );
Save and Activate
Save the file and ensure your child theme is activated.
After implementing any of these methods, clear your WordPress cache if you’re using a caching plugin, and then test your site to ensure Locadapt is working correctly.
If you encounter any issues or need further assistance, don’t hesitate to contact our support team at support@locadapt.com .