Shortcodes implements Registerable

Handles plugin shortcodes.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable

Table of Contents

discount_bulk_table()  : string
Display the bulk table for the discount. The discount ID can be passed as an attribute.
discount_content()  : string
Display the discount content. The discount ID can be passed as an attribute.
register()  : mixed
get_bulk_discount_id()  : int
Get the discount ID from the shortcode attributes.
get_product_id()  : int
Get the product ID from the shortcode attributes.

Methods

discount_bulk_table()

Display the bulk table for the discount. The discount ID can be passed as an attribute.

public discount_bulk_table(array<string|int, mixed> $atts[, string $content = '' ]) : string

If the discount ID is invalid or the discount is not a bulk discount, nothing will be displayed.

Example: [wdm_discount_bulk_table id="123"]

Note: the shortcode does not check if the discount is eligible for the current user or product.

Parameters
$atts : array<string|int, mixed>

The shortcode attributes.

$content : string = ''

The shortcode content.

Return values
string

discount_content()

Display the discount content. The discount ID can be passed as an attribute.

public discount_content(array<string|int, mixed> $atts[, string $content = '' ]) : string

If the discount ID is invalid or the discount has no content, nothing will be displayed.

Example: [wdm_discount_content id="123"]

Note: the shortcode does not check if the discount is eligible for the current user or product.

Parameters
$atts : array<string|int, mixed>

The shortcode attributes.

$content : string = ''

The shortcode content.

Return values
string

register()

public register() : mixed
Tags
inheritdoc
Return values
mixed

get_bulk_discount_id()

Get the discount ID from the shortcode attributes.

private get_bulk_discount_id(array<string|int, mixed> $atts) : int

If the discount ID is not set, try to get it from all the applicable discounts for the current product.

Parameters
$atts : array<string|int, mixed>

The shortcode attributes.

Return values
int

get_product_id()

Get the product ID from the shortcode attributes.

private get_product_id(array<string|int, mixed> $atts) : int

If the product ID is not set, try to get it from the current product.

Parameters
$atts : array<string|int, mixed>

The shortcode attributes.

Return values
int

Search results