Iubenda Cookie Law Solution Shortcodes

Below, you’ll find a detailed guide on how to add the Iubenda Cookie Law Solution Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Iubenda Cookie Law Solution Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Iubenda Cookie Law Solution Plugin and the shortcodes it provides:

Plugin Icon
iubenda | All-in-one Compliance for GDPR / CCPA Cookie Consent + more

"iubenda is a comprehensive solution for GDPR/CCPA cookie consent and more. This easy-to-use plugin ensures your WordPress site is fully compliant with all privacy laws, providing a seamless user experience."

★★★★☆ (291) Active Installs: 100000+ Tested with: 6.3.2 PHP Version: 7.0.0
Included Shortcodes:
  • [IUB_LEGAL_BLOCK_SHORTCODE]
  • [iub-tc-button]
  • [iub-pp-button]
  • [iub-cookie-policy]
  • [iub-cookie-skip]

Iubenda Cookie Law Solution [IUB_LEGAL_BLOCK_SHORTCODE] Shortcode

The iubenda-cookie-law-solution plugin shortcode, ‘IUB_LEGAL_BLOCK_SHORTCODE’, initiates the rendering of a legal block section. This shortcode calls the ‘render_iub_legal_block’ function, which constructs an HTML string. This string is then wrapped in a ‘section’ tag, creating a legal block on the page. The content can be customized using ‘before_iub_legal_block_section’ and ‘after_iub_legal_block_section’ filters.

Shortcode: [IUB_LEGAL_BLOCK_SHORTCODE]

Examples and Usage

Basic example – This shortcode displays the iubenda legal block on the page.

[iub_legal_block /]

PHP Function Code

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

Shortcode line:

add_shortcode( static::IUB_LEGAL_BLOCK_SHORTCODE, array( $this, 'render_iub_legal_block' ) );

Shortcode PHP function:

function render_iub_legal_block() {
		$html  = '';
		$html  = apply_filters( 'before_iub_legal_block_section', $html );
		$html .= '<section>' . $this->iub_legal_block_html( $html ) . '</section>';
		$html  = apply_filters( 'after_iub_legal_block_section', $html );

		return $html;
	}

Code file location:

iubenda-cookie-law-solution/iubenda-cookie-law-solution/includes/block/class-iubenda-legal-block.php

Iubenda Cookie Law Solution [iub-tc-button] Shortcode

The iubenda-cookie-law-solution plugin shortcode, ‘iub-tc-button’, is designed to manually position a ‘Terms & Conditions’ button on your site. This shortcode checks if the ‘tc.status’ service is active and if the ‘button_position’ option is set to ‘manual’. If both conditions are met, the ‘tc_button’ function is executed, displaying the ‘Terms & Conditions’ button. If not, the shortcode ‘[iub-tc-button]’ is returned.

Shortcode: [iub-tc-button]

Examples and Usage

Basic example – Show a Terms and Conditions button manually using the shortcode.

[iub-tc-button]

PHP Function Code

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

Shortcode line:

add_shortcode( 'iub-tc-button', array( new Quick_Generator_Service(), 'tc_button_shortcode' ) );

Shortcode PHP function:

function tc_button_shortcode() {
		if ( ( (string) iub_array_get( iubenda()->settings->services, 'tc.status' ) === 'true' ) && ( (string) iub_array_get( iubenda()->options['tc'], 'button_position' ) === 'manual' ) ) {
			return $this->tc_button();
		}

		return '[iub-tc-button]';
	}

Code file location:

iubenda-cookie-law-solution/iubenda-cookie-law-solution/includes/class-iubenda-settings.php

Iubenda Cookie Law Solution [iub-pp-button] Shortcode

The iubenda-cookie-law-solution plugin shortcode, ‘iub-pp-button’, is used to generate a privacy policy button. This button only appears when the privacy policy status is ‘true’ and its position isn’t set to ‘automatic’.

Shortcode: [iub-pp-button]

Examples and Usage

Basic example – Utilizes the ‘iub-pp-button’ shortcode to generate a privacy policy button without any additional parameters.

[iub-pp-button /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'iub-pp-button', array( new Quick_Generator_Service(), 'pp_button_shortcode' ) );

Shortcode PHP function:

function pp_button_shortcode() {
		if ( (string) iub_array_get( iubenda()->settings->services, 'pp.status' ) === 'true' && (string) iub_array_get( iubenda()->options['pp'], 'button_position' ) !== 'automatic' ) {
			return $this->pp_button();
		}

		return '[iub-pp-button]';
	}

Code file location:

iubenda-cookie-law-solution/iubenda-cookie-law-solution/includes/class-iubenda-settings.php

Iubenda Cookie Law Solution [iub-cookie-policy] Shortcode

The iub-cookie-policy shortcode is a part of the iubenda-cookie-law-solution plugin. It’s used to block content until users accept cookies. This shortcode works by wrapping content within the ‘IUB-COOKIE-BLOCK-START’ and ‘IUB-COOKIE-BLOCK-END’ comments. The content within these comments is blocked until the user accepts cookies.

Shortcode: [iub-cookie-policy]

Examples and Usage

Basic example – The iubenda-cookie-law-solution plugin shortcode is implemented to block cookies until the user has agreed to the cookie policy.

[iub-cookie-policy]

PHP Function Code

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

Shortcode line:

add_shortcode( 'iub-cookie-policy', array( $this, 'block_shortcode' ) );

Shortcode PHP function:

function block_shortcode( $atts, $content = '' ) {
		return '<!--IUB-COOKIE-BLOCK-START-->' . do_shortcode( $content ) . '<!--IUB-COOKIE-BLOCK-END-->';
	}

Code file location:

iubenda-cookie-law-solution/iubenda-cookie-law-solution/iubenda_cookie_solution.php

Iubenda Cookie Law Solution [iub-cookie-skip] Shortcode

The iubenda-cookie-law-solution plugin shortcode ‘iub-cookie-skip’ is designed to bypass certain sections from cookie blocking. This shortcode wraps the content within special comments, telling the plugin to exclude this part from cookie control.

Shortcode: [iub-cookie-skip]

Examples and Usage

Basic example – The following shortcode uses the iub-cookie-skip feature to skip cookie blocking. This is useful when you want to ensure that a specific section of your content is not affected by the cookie blocking functionality of the iubenda plugin.

[iub-cookie-skip]Your content here[/iub-cookie-skip]

PHP Function Code

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

Shortcode line:

add_shortcode( 'iub-cookie-skip', array( $this, 'skip_shortcode' ) );

Shortcode PHP function:

function skip_shortcode( $atts, $content = '' ) {
		return '<!--IUB-COOKIE-BLOCK-SKIP-START-->' . do_shortcode( $content ) . '<!--IUB-COOKIE-BLOCK-SKIP-END-->';
	}

Code file location:

iubenda-cookie-law-solution/iubenda-cookie-law-solution/iubenda_cookie_solution.php

Conclusion

Now that you’ve learned how to embed the Iubenda Cookie Law Solution Plugin shortcodes, 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 *