=== GetTerms Cookie Consent & Policies === Contributors: getterms Tags: privacy, terms of service, cookie consent, GDPR, compliance Requires at least: 4.7 Tested up to: 7.1 Stable tag: 1.6 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html The GetTerms plugin allows users to manage their GetTerms compliance packs, embed auto-updating policies, and display their Cookie Consent Widget. == Description == The GetTerms plugin helps you implement cookie consent management and embed legal policies directly into your WordPress site. It connects with your GetTerms account to provide compliant, auto-updating documents and a fully configurable cookie consent banner. == Features == - Connect to your GetTerms Compliance Pack using a unique token. - Embed the Cookie Consent Widget site-wide or via manual integration. - Shortcodes to display live-updated legal documents (Privacy Policy, Terms, AUP, etc.). - Support for multiple languages for both widget and policies. == Installation == 1. Go to your WordPress admin dashboard. 2. Navigate to `Plugins > Add New`. 3. Search for `GetTerms Cookie Consent & Policies`. 4. Click `Install Now` and then `Activate`. == Usage == === Setting Up === 1. Navigate to `GetTerms` in the WordPress admin menu. 2. Enter your GetTerms token and save your settings. === Embedding the Cookie Consent Widget === - Enable the auto-embed option in plugin settings to insert the consent widget in the `<head>` tag. - You can also embed manually with the provided script tag for advanced use cases or multilingual configurations. - To ensure proper consent enforcement, embed the script as early as possible in the head section. - If you have manually included other scripts in your `<head>` the recommendation is to manually embed the GetTerms script above all other scripts, and not use auto-embed === Using Shortcodes === Use the following shortcodes to display your policy documents: - `[getterms_privacy_en]`, `[getterms_terms_en]`, `[getterms_aup_en]` - `[getterms_privacy_fr]`, `[getterms_terms_fr]`, `[getterms_aup_fr]` - Additional languages and policies are listed in the plugin settings. === How wp_head and wp_enqueue_script work === WordPress loads styles and scripts in two steps: 1) Registration + enqueue (what you do in PHP) - You register a script/style and enqueue it using WordPress functions. - Common hooks: - `wp_enqueue_scripts` (front end): enqueue scripts/styles for the theme and plugins. - `admin_enqueue_scripts` (wp-admin): enqueue for specific admin screens. - `login_enqueue_scripts` (login screen): enqueue for wp-login.php. 2) Output (what WordPress prints into the page) - WordPress prints the enqueued styles and scripts into the HTML at the proper places, using theme hooks: - `wp_head`: prints styles and any head scripts (e.g., those with `$in_footer = false`). - `wp_footer`: prints scripts that were enqueued for the footer (those with `$in_footer = true`). In practice, you should enqueue on the correct action, and let WordPress output them on `wp_head`/`wp_footer`. Example: - Register and enqueue a script function myplugin_enqueue_assets() { wp_register_script( 'myplugin-frontend', plugins_url('dist/myplugin.js', __FILE__), array('jquery'), '1.0.0', true // load in footer ); wp_enqueue_script('myplugin-frontend'); } add_action('wp_enqueue_scripts', 'myplugin_enqueue_assets'); - What gets printed where - Because `$in_footer = true`, the script tag is printed near the end of the page when the theme calls `wp_footer()`. - If `$in_footer = false` (default), it will be printed in the `` when the theme calls `wp_head()`. How this plugin uses these hooks - For the Cookie Consent Widget, you can choose between: - Auto-embed: The plugin hooks into `wp_head` very early to print the consent script as high as possible in the `` for best consent enforcement. This is intentional because consent tools must run before other scripts. - Manual embed: You paste the provided `