WP101 Video Tutorial Shortcode

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

Before starting, here is an overview of the WP101 Video Tutorial Plugin and the shortcodes it provides:

Plugin Icon
WP101 Video Tutorial Plugin

"WP101 Video Tutorial Plugin is your go-to solution for WordPress learning. It integrates highly informative video tutorials directly into your WordPress dashboard, making it simpler to understand and navigate the platform."

★★★★✩ (12) Active Installs: 20000+ Tested with: 6.0.6 PHP Version: 5.4
Included Shortcodes:
  • [wp101]

WP101 Video Tutorial [wp101] Shortcode

The WP101 shortcode allows users to embed specific WP101 courses or videos on their site. It checks if the user’s subscription permits embedding, then loads the specified course or video.

Shortcode: [wp101]

Parameters

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

  • course – specifies the unique identifier of the WP101 course to display
  • video – specifies the unique identifier of the WP101 video to display

Examples and Usage

Basic example – Display a specific WP101 course using its unique identifier

[wp101 course="beginners-guide"]

Basic example – Show a particular WP101 video by using its unique identifier

[wp101 video="how-to-install-wordpress"]

Advanced examples

Embed a WP101 course or a video on your site, if your WP101 subscription allows embedding on the front-end. If the specified course or video is not found, a debug message will be displayed.

[wp101 course="advanced-seo-tips"]
[wp101 video="customizing-wordpress-themes"]

Please note that the ‘course’ and ‘video’ attributes in the shortcode should be replaced with the slug of the actual course or video you want to display.

PHP Function Code

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

Shortcode line:

add_shortcode( 'wp101', __NAMESPACE__ . '\render_shortcode' );

Shortcode PHP function:

function render_shortcode( $atts ) {
	$atts = shortcode_atts(
		[
			'course' => null,
			'video'  => null,
		],
		$atts,
		'wp101'
	);
	$api  = TemplateTags\api();

	if ( ! $api->account_can( 'embed-on-front-end' ) ) {
		return shortcode_debug( __( 'Your WP101 subscription does not permit embedding on the front-end of a site.', 'wp101' ) );
	}

	// Load the requisite files.
	wp_enqueue_style( 'wp101' );

	if ( $atts['course'] ) {
		$series = TemplateTags\get_series( $atts['course'] );

		if ( false === $series ) {
			return shortcode_debug(
				sprintf(
					/* Translators: %1$s is the series slug. */
					__( 'Course "%1$s" was not found.', 'wp101' ),
					$atts['course']
				)
			);
		}

		return render_shortcode_playlist( $series );

	} elseif ( $atts['video'] ) {
		$topic = TemplateTags\get_topic( $atts['video'] );

		if ( false === $topic ) {
			return shortcode_debug(
				sprintf(
					/* Translators: %1$s is the video slug. */
					__( 'Video "%1$s" was not found.', 'wp101' ),
					$atts['video']
				)
			);
		}

		return render_shortcode_single( $topic );
	}

	return shortcode_debug( __( 'No WP101 courses or video were specified.', 'wp101' ) );
}

Code file location:

wp101/wp101/includes/shortcode.php

Conclusion

Now that you’ve learned how to embed the WP101 Video Tutorial 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 *