Quick and Easy FAQs Shortcode

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

Before starting, here is an overview of the Quick and Easy FAQs Plugin and the shortcodes it provides:

Plugin Icon
Quick and Easy FAQs

"Quick and Easy FAQs is a WordPress plugin designed to simplify the process of creating, managing, and displaying frequently asked questions on your website."

★★★★☆ (34) Active Installs: 20000+ Tested with: 6.2.3 PHP Version: 5.6
Included Shortcodes:
  • [faqs]

Quick and Easy FAQs [faqs] Shortcode

The Quick-and-Easy-FAQs plugin shortcode displays a list of FAQs on your webpage. It allows customization of style, filter, order, and limit. The ‘style’ attribute offers various display options, while ‘filter’ enables selection of specific FAQs. ‘Orderby’ and ‘order’ control the sequence, and ‘limit’ sets the number of FAQs.

Shortcode: [faqs]

Parameters

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

  • style – defines the FAQ display style (toggle, accordion, etc.)
  • filter – allows filtering of the FAQs
  • orderby – determines the order of FAQs by date
  • order – sets the direction of the order (Descending or Ascending)
  • limit – limits the number of FAQs displayed

Examples and Usage

Basic example – Displaying a simple FAQs list without any custom parameters.

[faqs /]

Advanced examples

Displaying an FAQs list in an accordion style, ordered by title in ascending order, and limited to 5 FAQs.

[faqs style="accordion" orderby="title" order="ASC" limit="5" /]

Displaying an FAQs list in a toggle-grouped style, with a specific group filter.

[faqs style="toggle-grouped" filter="group1,group2" /]

Displaying an FAQs list in descending order by date, with a filter for a particular group and a limit on the number of FAQs displayed.

[faqs filter="group1" order="DESC" limit="10" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'faqs', array( $this, 'display_faqs_list' ) );

Shortcode PHP function:

function display_faqs_list( $attributes ) {

		$attributes = $this->old_shortcode_fallback( $attributes );

		extract(
			shortcode_atts(
				array(
					'style'   => '',    // Possible Values: toggle, accordion, toggle-grouped, accordion-grouped
					'filter'  => false,
					'orderby' => 'date',
					'order'   => 'DESC',
					'limit'   => -1,
				),
				$attributes,
				'faqs'
			)
		);

		// faq groups filter.
		if ( isset( $filter ) && ! empty( $filter ) && 'true' != $filter ) {
			$filter = explode( ',', $filter );
		}

		ob_start();

		$faqs_query = new FAQs_Query( $style, $filter, $orderby, $order, $limit );
		$faqs_query->render();

		wp_localize_script(
			$this->plugin_name,
			'qaef_object',
			array(
				'ajaxurl' => admin_url( 'admin-ajax.php' ),
				'style'   => $style,
			)
		);
		wp_enqueue_script( $this->plugin_name );

		return ob_get_clean();

	}

Code file location:

quick-and-easy-faqs/quick-and-easy-faqs/frontend/class-shortcode.php

Conclusion

Now that you’ve learned how to embed the Quick and Easy FAQs 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 *