Featured Video Plus Shortcode

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

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

Plugin Icon
Featured Video Plus

"Featured Video Plus is a versatile WordPress plugin that enables users to easily add featured videos to their posts and pages, enhancing visual engagement on their sites."

★★★★☆ (79) Active Installs: 20000+ Tested with: 4.7.27 PHP Version: false
Included Shortcodes:
  • [featured-video-plus width="500" height="300"]

Featured Video Plus [featured-video-plus] Shortcode

The Featured Video Plus shortcode enables video embedding in posts. It takes width and height parameters to customize the display. This shortcode checks if a post has a video. If true, it returns the post video with specified dimensions.

Shortcode: [featured-video-plus width="500" height="300"]

Parameters

Here is a list of all possible featured-video-plus width=”500″ height=”300″ shortcode parameters and attributes:

  • width – Specifies the width of the featured video
  • height – Determines the height of the featured video

Examples and Usage

Basic example – The shortcode below will display the featured video of the post. If the post has a featured video, it will be displayed with default width and height.

[featured-video-plus /]

Advanced examples

Displaying the featured video with specified width and height. In this example, the width is set to 500 and the height is set to 300. If the post has a featured video, it will be displayed with these dimensions.

[featured-video-plus width=500 height=300 /]

Displaying the featured video with only the width specified. In this example, the width is set to 500. If the post has a featured video, it will be displayed with this width and the default height.

[featured-video-plus width=500 /]

Displaying the featured video with only the height specified. In this example, the height is set to 300. If the post has a featured video, it will be displayed with this height and the default width.

[featured-video-plus height=300 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [featured-video-plus width="500" height="300"] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'featured-video-plus', array( $this, 'shortcode' ) );

Shortcode PHP function:

function shortcode( $atts = null ) {
		$w = isset( $atts['width'] )  ? $atts['width']  : '';
		$h = isset( $atts['height'] ) ? $atts['height'] : '';

		if ( has_post_video() ) {
			return get_the_post_video( null, array( $w, $h ) );
		}
	}

Code file location:

featured-video-plus/featured-video-plus/php/class-main.php

Conclusion

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