HelloAsso Shortcode

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

Before starting, here is an overview of the HelloAsso Plugin and the shortcodes it provides:

Plugin Icon
HelloAsso

"HelloAsso is a versatile WordPress plugin designed to streamline your fundraising efforts. It integrates seamlessly with your website, allowing easy donation collection and management."

★★★✩✩ (2) Active Installs: 3000+ Tested with: 6.0.6 PHP Version: 7.2.34
Included Shortcodes:
  • [helloasso]

HelloAsso [helloasso] Shortcode

The Helloasso shortcode is a function that dynamically generates an iframe based on the attributes passed. It accepts two parameters: ‘campaign’ and ‘type’. The ‘campaign’ attribute represents the URL, while ‘type’ determines the iframe’s size and style. If ‘type’ equals “widget-bouton”, a small button-sized iframe is created. If it’s “widget”, a larger, full-width iframe is generated. If ‘type’ equals “widget-vignette”, a medium-sized iframe is produced. The function returns an iframe with the specified URL and style.

Shortcode: [helloasso]

Parameters

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

  • campaign – The URL of the HelloAsso campaign to display
  • type – Determines the style and size of the displayed widget. It can be one of three possible values:
    • widget-bouton – Creates a compact button-style widget with dimensions 200px by 70px
    • widget – Creates a full-size widget that takes up 100% of the width and has a height of 750px
    • widget-vignette – Creates a small thumbnail-style widget with dimensions 350px by 450px

Examples and Usage

Basic example – A simple usage of the helloasso shortcode to embed a widget button related to a specific campaign on your website.

[helloasso campaign="your-campaign-url" type="widget-bouton" /]

Advanced examples

Embedding a full-size widget related to a specific campaign on your website. The widget will occupy 100% width and 750px height of the container it is placed in.

[helloasso campaign="your-campaign-url" type="widget" /]

Embedding a thumbnail-sized widget related to a specific campaign on your website. The widget will have a fixed size of 350px width and 450px height.

[helloasso campaign="your-campaign-url" type="widget-vignette" /]

Note: Replace “your-campaign-url” with the actual URL of your campaign. The type parameter defines the style and size of the widget. It can take one of three values: “widget-bouton”, “widget”, or “widget-vignette”.

PHP Function Code

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

Shortcode line:

add_shortcode( 'helloasso', 'ha_shortcode' );

Shortcode PHP function:

                    function ha_shortcode($atts)
		{
			$url = $atts['campaign'];
			$type = $atts['type'];
			if($type == "widget-bouton")
			{
				$styleIframe = 'style="width:200px; height:70px; border:none;"';
			}
			elseif($type == "widget")
			{
				$styleIframe = 'style="width:100%; height:750px; border:none;"';
			}
			elseif($type == "widget-vignette")
			{
				$styleIframe = 'style="width:350px; height:450px; border:none;"';
			}

			ob_start();
			?>
			<iframe src="<?= $url; ?><?= $type; ?>"  id="idIframe" <?= $styleIframe; ?> border="0"></iframe>
			<?php
			return ob_get_clean();
		}
                    

Code file location:

helloasso/helloasso/public/class-hello-asso-public.php

Conclusion

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