Responsive Accordion And Collapse Shortcode

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

Before starting, here is an overview of the Responsive Accordion And Collapse Plugin and the shortcodes it provides:

Plugin Icon
Accordion FAQ – Compatible With All Page Builder (Elementor, Gutenberg)

"Accordion FAQ – Compatible With All Page Builder (Elementor, Gutenberg) is a versatile plugin that enables easy creation of responsive FAQs. It seamlessly integrates with any page builder for easy website customization."

★★★★☆ (637) Active Installs: 50000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [WPSM_AC]

Responsive Accordion And Collapse [WPSM_AC] Shortcode

The ‘WPSM_AC’ shortcode is a part of the responsive-accordion-and-collapse plugin. It calls the function ‘AccordionShortCode’ which takes an ID as a parameter. The function checks if an ID is provided, if not, it sets the ID to an empty string. It then requires the ‘ac-content.php’ file and resets the WordPress query. The output is then returned.

Shortcode: [WPSM_AC]

Parameters

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

  • id – Specific identifier for the accordion content.

Examples and Usage

Basic example – The shortcode below is a simple usage of the WPSM_AC shortcode, where we are passing the ID of the accordion content we want to display.

[WPSM_AC id=1 /]

Advanced examples

Here, we are using the shortcode to display different accordion contents based on their IDs. If the accordion content with the specified ID is not found, it will not display anything.

[WPSM_AC id=2 /]

In this example, we are using the shortcode to display multiple accordion contents. We achieve this by calling the shortcode multiple times with different IDs.

[WPSM_AC id=1 /]
[WPSM_AC id=2 /]
[WPSM_AC id=3 /]

Note: In the examples above, replace the numbers 1, 2, and 3 with the actual IDs of the accordion contents you want to display.

PHP Function Code

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

Shortcode line:

add_shortcode( 'WPSM_AC', 'AccordionShortCode' );

Shortcode PHP function:

function AccordionShortCode( $Id ) {
	ob_start();	
	if(!isset($Id['id'])) 
	 {
		$WPSM_AC_ID = "";
	 } 
	else 
	{
		$WPSM_AC_ID = $Id['id'];
	}
	require("ac-content.php"); 
	wp_reset_query();
    return ob_get_clean();
}

Code file location:

responsive-accordion-and-collapse/responsive-accordion-and-collapse/front/shortcode.php

Conclusion

Now that you’ve learned how to embed the Responsive Accordion And Collapse 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 *