Raptive Ads Shortcode

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

Before starting, here is an overview of the Raptive Ads Plugin and the shortcodes it provides:

Plugin Icon
Raptive Ads

"Raptive Ads is a dynamic WordPress plugin that helps users seamlessly integrate, manage, and optimize AdThrive advertisements on their website for maximum revenue generation."

★★★★★ (3) Active Installs: 5000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [adthrive-in-post-video-player]

Raptive Ads [adthrive-in-post-video-player] Shortcode

The AdThrive-In-Post-Video-Player shortcode is designed to manage video metadata on your WordPress site. It can enable or disable metadata on a site-wide or individual post basis. The shortcode takes in attributes like video-id, name, description, upload-date, player-type, and override-embed. It then processes these attributes and returns a video player embedded within your post.

Shortcode: [adthrive-in-post-video-player]

Parameters

Here is a list of all possible adthrive-in-post-video-player shortcode parameters and attributes:

  • video-id – The specific identifier for the video to be played.
  • name – The title or name of the video.
  • description – A brief summary about the video content.
  • upload-date – The date when the video was uploaded.
  • add-meta – Determines whether to add video metadata or not.
  • player-type – Defines the type of video player used.
  • override-embed – Controls whether to override the existing video embed or not.

Examples and Usage

Basic example – Displaying a video using the AdThrive Ads plugin shortcode. This example will use the video ID to load the video player.

[adthrive-in-post-video-player video-id="12345" /]

Advanced examples

Displaying a video with additional metadata. This example will include the video ID, name, description, and upload date. It will also override the default embed setting.

[adthrive-in-post-video-player video-id="12345" name="Sample Video" description="This is a sample video." upload-date="2022-01-01" override-embed="true" /]

Controlling the metadata display on a site-wide or post-specific basis. This example will disable metadata for the video on the site but enable it for this specific post.

[adthrive-in-post-video-player video-id="12345" add-meta="off" /]

Customizing the player type. This example will use a specific player type for the video.

[adthrive-in-post-video-player video-id="12345" player-type="custom" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [adthrive-in-post-video-player] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'adthrive-in-post-video-player', array( $this, 'in_post_video_player_shortcode' ) );

Shortcode PHP function:

function in_post_video_player_shortcode( $atts ) {
		$disable_meta_on_site = \AdThrive_Ads\Options::get( 'disable_video_metadata' );
		$disable_meta_in_post = get_post_meta( get_the_ID(), 'adthrive_ads_disable_metadata' );
		$enable_meta_in_post = get_post_meta( get_the_ID(), 'adthrive_ads_enable_metadata' );

		$add_meta = 'on';
		if ( isset( $disable_meta_on_site ) && 'on' === $disable_meta_on_site ) {
			if ( ! isset( $enable_meta_in_post[0] ) ) {
				$add_meta = '';
			}
		} else {
			if ( isset( $disable_meta_in_post[0] ) && 'on' === $disable_meta_in_post[0] ) {
				$add_meta = '';
			}
		}

		$atts = shortcode_atts(
			array(
				'video-id' => '',
				'name' => '',
				'description' => '',
				'upload-date' => '',
				'add-meta' => $add_meta,
				'player-type' => '',
				'override-embed' => '',
			),
			$atts,
			'adthrive-in-post-video-player'
		);

		ob_start();

		require 'partials/in-post.php';

		return ob_get_clean();
	}

Code file location:

adthrive-ads/adthrive-ads/components/video-player/class-main.php

Conclusion

Now that you’ve learned how to embed the Raptive Ads 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 *