LLMS_Shortcodes::access_plan_button( array $atts, string $content = '' )

Create a button for an Access Plan


Parameters Parameters

$atts

(array) (Required) Associative array of shortcode attributes.

$content

(string) (Optional) Shortcode content, enables custom text/html in the button.

Default value: ''


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/shortcodes/class.llms.shortcodes.php

	 */
	public static function access_plan_button( $atts, $content = '' ) {

		$atts = shortcode_atts(
			array(
				'classes' => '',
				'id'      => null,
				'size'    => '', // Can be: small, large.
				'type'    => 'primary', // Can be: primary, secondary, action, danger.
			),
			$atts,
			'lifterlms_access_plan_button'
		);

		$ret = '';

		if ( ! empty( $atts['id'] ) && is_numeric( $atts['id'] ) ) {
			$plan = new LLMS_Access_Plan( $atts['id'] );

			$classes  = 'llms-button-' . $atts['type'];
			$classes .= ! empty( $atts['size'] ) ? ' ' . $atts['size'] : '';
			$classes .= ! empty( $atts['classes'] ) ? ' ' . $atts['classes'] : '';

			$text = empty( $content ) ? $plan->get_enroll_text() : $content;

			$ret = '<a class="' . esc_attr( $classes ) . '" href="' . esc_url( $plan->get_checkout_url() ) . '" title="' . esc_attr( $plan->get( 'title' ) ) . '">' . $text . '</a>';
		}

		/**
		 * Filters the access plan button shortcode output
		 *
		 * @since unknown
		 *
		 * @param string $ret     The shortcode output.
		 * @param array  $atts    Associative array of shortcode attributes.
		 * @param string $content Shortcode content, enables custom text/html in the button. Default empty string.
		 */
		return apply_filters( 'llms_shortcode_access_plan_button', $ret, $atts, $content );



Top ↑

Changelog Changelog

Changelog
Version Description
3.4.1 Unknown.
3.2.5 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.