Civic Cookie Control Shortcode

Below, you’ll find a detailed guide on how to add the Civic Cookie Control Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Civic Cookie Control Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Civic Cookie Control Plugin and the shortcodes it provides:

Plugin Icon
Civic Cookie Control

"Civic Cookie Control is a WordPress plugin that provides comprehensive solutions for GDPR & CCPA compliance. Manage and control cookie consents efficiently with Civic Cookie Control."

★★★☆✩ (7) Active Installs: 2000+ Tested with: 6.2.3 PHP Version: 5.6
Included Shortcodes:
  • [ccc_gov_uk_block]

Civic Cookie Control [ccc_gov_uk_block] Shortcode

The Civic Cookie Control 8 shortcode, ‘ccc_gov_uk_block’, is used to manage cookie preferences on a website. It extracts attributes like ‘layout’ from the shortcode and includes the ‘govuk-cookiecontrol-details.php’ template.

Shortcode: [ccc_gov_uk_block]

Parameters

Here is a list of all possible ccc_gov_uk_block shortcode parameters and attributes:

  • layout – defines the layout style of the cookie control details

Examples and Usage

Basic example – The shortcode is used to display the cookie control details using the default layout.

[ccc_gov_uk_block /]

Advanced examples

Displaying the cookie control details using a custom layout. The layout file should be placed in the ‘templates’ directory of the plugin.

[ccc_gov_uk_block layout="custom" /]

Using the shortcode to display cookie control details with a custom layout and additional parameters. This example assumes that the custom layout file can handle these additional parameters.

[ccc_gov_uk_block layout="custom" param1="value1" param2="value2" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [ccc_gov_uk_block] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'ccc_gov_uk_block', array( $plugin_public, 'ccc_gov_uk_details' ));

Shortcode PHP function:

function ccc_gov_uk_details($attributes)
	{
		// Extract the shortcode attributes
		extract(shortcode_atts(array(
			'layout' => 'default',
		), $attributes));
		include plugin_dir_path(__FILE__) . 'templates/govuk-cookiecontrol-details.php';
		return $output;
	}

Code file location:

civic-cookie-control-8/civic-cookie-control-8/includes/class-cookie-control.php

Conclusion

Now that you’ve learned how to embed the Civic Cookie Control Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *