Stylish Price List Shortcode

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

Before starting, here is an overview of the Stylish Price List Plugin and the shortcodes it provides:

Plugin Icon
Stylish Price List – Price Table Builder & QR Code Restaurant Menu

"Stylish Price List is a versatile plugin for creating sleek pricing tables & QR Code menus for restaurants. Elevate your site with this easy-to-use builder."

★★★★☆ (92) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [pricelist]

Stylish Price List [pricelist] Shortcode

The Stylish Price List shortcode is a powerful tool that displays a custom price list on your WordPress site. Using the ‘pricelist’ shortcode, you can extract and display information based on the ‘id’ attribute. It enqueues necessary styles and scripts, such as ‘spl-list-style’, ‘spl-bootstrap-min’, ‘spl-pricelist-tabs’, ‘spl-pricelist-jquery-wookmark’, and ‘font-awwsone’. The output is then buffered and returned after including the ‘pricelist-frontend.php’ file. This ensures your price list is displayed correctly and stylishly.

Shortcode: [pricelist]

Parameters

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

  • id – Specifies the unique id of the price list to display

Examples and Usage

Basic example – In the following example, the shortcode is used to display a price list with a specific ID.

[pricelist id=1 /]

Advanced examples

Here, the shortcode is used to display multiple price lists by specifying their IDs. This is useful when you want to display different price lists on the same page.

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

The following example shows how to use the shortcode to display a price list and then enqueue a specific style and script. This is useful when you want to customize the look and feel of the price list.

[pricelist id=1 /]
wp_enqueue_style( 'custom-style' );
wp_enqueue_script( 'custom-script' );

Please note that the ‘custom-style’ and ‘custom-script’ must be registered with WordPress before they can be enqueued.

PHP Function Code

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

Shortcode line:

add_shortcode( 'pricelist', 'spl_shortcode_pricelist' );

Shortcode PHP function:

function spl_shortcode_pricelist( $atts, $content = null ) {
	extract(
		shortcode_atts(
			array(
				'id' => '',

			),
			$atts
		)
	);

	/* you can use following enqueue in a shortcode to load as required */

	wp_enqueue_style( 'spl-list-style' );
	wp_enqueue_style( 'spl-bootstrap-min' );
	// wp_enqueue_script( 'spl-bootstrap-min' );
	wp_enqueue_script( 'spl-pricelist-tabs' );
	wp_enqueue_script( 'spl-pricelist-jquery-wookmark' );

	wp_enqueue_style( 'font-awwsone' );
	ob_start();
	include dirname( __FILE__ ) . '/pricelist-frontend.php';
	return ob_get_clean();

}

Code file location:

stylish-price-list/stylish-price-list/shortcode/pricelist.php

Conclusion

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