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

Create a button for an Access Plan


Description Description


Parameters Parameters

$atts

(array) (Required) 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' => '', // small, large
			'type' => 'primary', // 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>';
		}

		return apply_filters( 'llms_shortcode_access_plan_button', $ret, $atts, $content );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.5 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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