Designil PDPA Thailand Shortcodes

Below, you’ll find a detailed guide on how to add the Designil PDPA Thailand 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 Designil PDPA Thailand Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Designil PDPA Thailand Plugin and the shortcodes it provides:

✩✩✩✩✩ () Active Installs: + Tested with: PHP Version:
Included Shortcodes:

Designil PDPA Thailand [dpdpa_settings] Shortcode

The ‘dpdpa_settings’ shortcode is a feature of the PDPA-Thailand plugin. It generates a clickable link with a customizable title that leads to cookie settings.

Shortcode: [dpdpa_settings]

Parameters

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

  • title – Changes the text displayed on the settings link

Examples and Usage

Basic example – The following shortcode will display a link that triggers a popup for cookie settings. The link text will be the default “Cookies settings”.

[dpdpa_settings /]

Advanced examples

Customizing the title of the link. In this case, the link text will be “Manage your preferences”.

[dpdpa_settings title="Manage your preferences" /]

Using the shortcode to display the link in a different language. The title parameter is translated using the WordPress __(‘text’, ‘text-domain’) function. In this example, the text domain is ‘pdpa-thailand’, and the title is ‘ตั้งค่าคุกกี้’ which translates to ‘Cookie settings’ in Thai.

[dpdpa_settings title=__('ตั้งค่าคุกกี้', 'pdpa-thailand') /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'dpdpa_settings', array($this, 'shortcode_dpdpa_settings') );

Shortcode PHP function:

                    function shortcode_dpdpa_settings($atts)
    {        
        if ( !isset($atts["title"]) ) 
            $atts["title"] = __('Cookies settings', 'pdpa-thailand');
        
        return '<a href="#" class="dpdpa--popup-settings">' . $atts["title"] . '</a>';
    }
                    

Code file location:

pdpa-thailand/pdpa-thailand/public/public.php

Designil PDPA Thailand [dpdpa_policy_page] Shortcode

The ‘dpdpa_policy_page’ shortcode of the PDPA-Thailand plugin generates a link to the privacy policy page. It accepts a ‘title’ attribute to customize the link text. If no title is provided, it defaults to ‘Privacy policy’.

Shortcode: [dpdpa_policy_page]

Parameters

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

  • title – Specifies the title of the privacy policy link.

Examples and Usage

Basic example – Here’s how to use the shortcode to display a basic Privacy Policy link with the default title.

[dpdpa_policy_page /]

With this basic usage, the shortcode will automatically generate a link to your Privacy Policy page, using the default title ‘Privacy Policy’.

Advanced examples

You can use the shortcode to display a Privacy Policy link with a custom title. Simply include the ‘title’ attribute in the shortcode and set it to your desired title.

[dpdpa_policy_page title="My Custom Privacy Policy" /]

In this advanced example, the shortcode will generate a link to your Privacy Policy page, but instead of using the default title, it will use the custom title ‘My Custom Privacy Policy’.

You can also use multiple attributes in the shortcode to customize the output further. For example, you could specify both the ‘title’ and ‘id’ attributes to display a link to a specific Privacy Policy page with a custom title.

[dpdpa_policy_page title="My Custom Privacy Policy" id="123" /]

In this advanced example, the shortcode will generate a link to the specific Privacy Policy page with the ID of ‘123’, and it will use the custom title ‘My Custom Privacy Policy’.

PHP Function Code

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

Shortcode line:

add_shortcode( 'dpdpa_policy_page', array($this, 'shortcode_dpdpa_policy_page') );

Shortcode PHP function:

                    function shortcode_dpdpa_policy_page($atts)
    {
        if ( !isset($atts["title"]) ) 
            $atts["title"] = __('Privacy policy', 'pdpa-thailand');

        return '<a href="' . get_the_permalink($this->msg['policy_page']) . '">' . $atts["title"] . '</a>';
    }
                    

Code file location:

pdpa-thailand/pdpa-thailand/public/public.php

Conclusion

Now that you’ve learned how to embed the Designil PDPA Thailand 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 *