Photo Video Gallery Master Shortcode

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

Before starting, here is an overview of the Photo Video Gallery Master Plugin and the shortcodes it provides:

Plugin Icon
Photo Video Gallery Master

"Photo Video Gallery Master is a dynamic WordPress plugin that allows you to seamlessly create and manage your multimedia galleries. Perfect for showcasing photos and videos in a stunning layout."

★★★★✩ (17) Active Installs: 3000+ Tested with: 5.3.16 PHP Version: false
Included Shortcodes:
  • [PVGM]

Photo Video Gallery Master [PVGM] Shortcode

The PhotoVideoGalleryMaster shortcode is a feature-packed tool for managing and displaying photo and video galleries in WordPress. It offers various customization options for gallery layout, color schemes, and content display. This shortcode fetches the gallery settings and images, then renders the gallery on the front end. It handles gallery existence and empty gallery checks. It also offers options to show or hide gallery title, image labels, descriptions, and buttons. Shortcode: [PVGM]

Shortcode: [PVGM]

Parameters

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

  • id – The unique identifier of the gallery

Examples and Usage

Basic example – Displaying a photo video gallery by referencing the ID of the gallery.

[PVGM id=1 /]

Advanced examples

Using the shortcode to display a photo video gallery by referencing the ID of the gallery and customizing the gallery’s color, button text, and label font size. This allows you to customize the appearance of the gallery to match your website’s theme.

[PVGM id=1 PVGM_Color="#FF0000" PVGM_Button_Text="View More" PVGM_Lable_Font_Size="20px" /]

Using the shortcode to display a photo video gallery by referencing the ID of the gallery and customizing the gallery’s effect, button background color, and description text color. This allows you to create a unique look and feel for each gallery on your website.

[PVGM id=1 PVGM_Effect="fade" PVGM_Button_Bg_Color="#000000" PVGM_Descp_Text_Color="#FFFFFF" /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'PVGM', 'PhotoVideoGalleryMasterShortCode' );

Shortcode PHP function:

                    function PhotoVideoGalleryMasterShortCode( $Id ) {
	
	$PVGM_Id = $Id['id'];
	$TotalImages =  get_post_meta( $PVGM_Id, 'PVGM_total_images_count', true );
	if( $TotalImages == "" ){
		ob_start();
		printf( __( "Gallery with ID %s doesn't exist.","PVGM_TEXT_DOMAIN" ), $PVGM_Id );
		return ob_get_clean();
	}
	if( $TotalImages == 0 ){
		ob_start();
		printf( __( "Gallery with ID %s is empty.","PVGM_TEXT_DOMAIN" ), $PVGM_Id );
		return ob_get_clean();
	}
	
    ob_start();
	$PVGM_Gallery_Settings = pvgm_get_gallery_value($PVGM_Id);
	if(count($PVGM_Gallery_Settings)) {
		$PVGM_Effect				= esc_attr( $PVGM_Gallery_Settings['PVGM_Effect'] );
		$PVGM_Color 				= esc_attr( $PVGM_Gallery_Settings['PVGM_Color'] );
		$PVGM_Label_Bg_Color 		= esc_attr( $PVGM_Gallery_Settings['PVGM_Label_Bg_Color'] );
		$PVGM_Label_Text_Color 		= esc_attr( $PVGM_Gallery_Settings['PVGM_Label_Text_Color'] );
		$PVGM_Descp_Text_Color 		= esc_attr( $PVGM_Gallery_Settings['PVGM_Descp_Text_Color'] );
		$PVGM_Button_Bg_Color 		= esc_attr( $PVGM_Gallery_Settings['PVGM_Button_Bg_Color'] );
		$PVGM_Button_Text_Color 	= esc_attr( $PVGM_Gallery_Settings['PVGM_Button_Text_Color'] );
		$PVGM_Show_Gallery_Title	= esc_attr( $PVGM_Gallery_Settings['PVGM_Show_Gallery_Title'] );
		$PVGM_Show_Image_Label		= esc_attr( $PVGM_Gallery_Settings['PVGM_Show_Image_Label'] );
		$PVGM_Show_Image_Descp		= esc_attr( $PVGM_Gallery_Settings['PVGM_Show_Image_Descp'] );
		$PVGM_Show_Image_Button		= esc_attr( $PVGM_Gallery_Settings['PVGM_Show_Image_Button'] );
		$PVGM_Button_Radious		= esc_attr( $PVGM_Gallery_Settings['PVGM_Button_Radious'] );
		$PVGM_Button_Text			= esc_attr( $PVGM_Gallery_Settings['PVGM_Button_Text'] );
		$PVGM_Gallery_Layout		= esc_attr( $PVGM_Gallery_Settings['PVGM_Gallery_Layout'] );
		$PVGM_Open_Link        		= esc_attr( $PVGM_Gallery_Settings['PVGM_Open_Link'] );
		$PVGM_Font_Style			= esc_attr( $PVGM_Gallery_Settings['PVGM_Font_Style'] );
		$PVGM_Lable_Font_Size		= esc_attr( $PVGM_Gallery_Settings['PVGM_Lable_Font_Size']);
		$PVGM_tlineheight			= esc_attr( $PVGM_Gallery_Settings['PVGM_tlineheight']);
		$PVGM_Desc_Font_Size		= esc_attr( $PVGM_Gallery_Settings['PVGM_Desc_Font_Size']);
		$PVGM_Light_Box				= esc_attr( $PVGM_Gallery_Settings['PVGM_Light_Box'] );
		$PVGM_Image_Border			= esc_attr( $PVGM_Gallery_Settings['PVGM_Image_Border'] );
		$PVGM_Custom_CSS			= wp_filter_nohtml_kses( $PVGM_Gallery_Settings['PVGM_Custom_CSS'] );
	}
?>
	<script type="text/javascript">
		jQuery(document).ready(function(){
			;( function( jQuery ) {
				jQuery( '.swipebox_<?php echo $PVGM_Id;?>' ).swipebox({
							hideBarsDelay:0,
							hideCloseButtonOnMobile : false,
						});
			})( jQuery );
		});
	</script>
<?php 
	$border =  PVGM_hex2rgb( "#000000" );
	$image_border = implode(", ", $border);
    $bg_color =  PVGM_hex2rgb( $PVGM_Color );
	$img_bg_color = implode(", ", $bg_color);
	
	$Label_Bg_Color =  PVGM_hex2rgb( $PVGM_Label_Bg_Color );
	$Label_Bg_Color = implode(", ", $Label_Bg_Color);
	
	$Label_Text_Color =  PVGM_hex2rgb( $PVGM_Label_Text_Color );
	$Label_Text_Color = implode(", ", $Label_Text_Color);
	
	$Button_Bg_Color =  PVGM_hex2rgb( $PVGM_Button_Bg_Color );
	$Button_Bg_Color = implode(", ", $Button_Bg_Color);
	
	if($PVGM_Button_Text == ""){
		$PVGM_Button_Text = "Read More";
	}

	include("css/style_common.php");
?>

	<?php if($PVGM_Show_Gallery_Title=="yes" && !empty(get_the_title($PVGM_Id))){?>
	<div class="pvgm-gallery-title">
        <?php echo esc_attr( get_the_title($PVGM_Id) ) ;?>
    </div>
	<?php } ?>
	
	<div class="row pvgm-gallery" id="pvgm_<?php echo $PVGM_Id;?>">
	<?php
		$PVGM_AllPhotosDetails = unserialize(get_post_meta( $PVGM_Id, 'PVGM_all_photos_details', true));
		$TotalImages =  get_post_meta( $PVGM_Id, 'PVGM_total_images_count', true );
		if($TotalImages) {
			foreach($PVGM_AllPhotosDetails as $PVGM_SinglePhotoDetails) {
				$name = esc_attr( $PVGM_SinglePhotoDetails['PVGM_image_label'] );
				$url = esc_url( $PVGM_SinglePhotoDetails['PVGM_image_url'] );
				$circle = esc_url( $PVGM_SinglePhotoDetails['PVGM_gallery_admin_circle'] );
				$video = esc_url( $PVGM_SinglePhotoDetails['PVGM_video_link'] ); 
				$link = esc_url( $PVGM_SinglePhotoDetails['PVGM_external_link'] );
				$type = esc_attr( $PVGM_SinglePhotoDetails['PVGM_portfolio_type'] );
				$description = stripslashes(esc_attr($PVGM_SinglePhotoDetails['PVGM_image_descp']));
				if(isset($PVGM_SinglePhotoDetails['PVGM_image_alt'])){
					$alt = $PVGM_SinglePhotoDetails['PVGM_image_alt'];
				}else{
					$alt = "";
				}
				if($type=="image"){
					$href_link = $url;
				}  elseif($type=="link"){
					$href_link = $link;
				} else {
					$href_link = $video;
				}
				
				?>
				<div class="<?php echo $PVGM_Gallery_Layout; ?> col-sm-6 wl-gallery">
				
				<?php if($PVGM_Show_Image_Button == "no"){ ?>
					<a href="<?php echo $href_link; ?>" <?php  
								if($type != "link") { ?> class="swipebox_<?php echo $PVGM_Id; ?> info" title="<?php echo $alt; ?>" <?php }else{ ?> class="info" target="<?php echo $PVGM_Open_Link; ?>" <?php } 
								?>>
						<div class="view view-<?php echo $PVGM_Effect ?> " style="cursor:pointer !important;">
							<img src="<?php echo $circle; ?>" alt="<?php echo $alt; ?>" />
							<div class="mask">
							<?php if( $PVGM_Show_Image_Label =="yes"){ ?>
								<h2 class="h2"><?php echo $name; ?></h2>
							<?php } ?>	
								<p>
								<?php  if($PVGM_Show_Image_Descp == "yes") { 
									echo $description;
								} ?>
								</p>
							</div>
						</div> 
					</a>
				<?php } else {?>
				
					<div class="view view-<?php echo $PVGM_Effect ?> ">
						<img src="<?php echo $circle; ?>" alt="<?php echo $alt; ?>" />
						<div class="mask">
							<?php if( $PVGM_Show_Image_Label =="yes" && $name != ""){ ?>
							<h2 class="h2"><?php echo $name; ?></h2>
							<?php }else{ ?>
								<span class="t_20"></span>
							<?php	
							} ?>
							<p>
							<?php  if($PVGM_Show_Image_Descp == "yes") { 
								echo $description;
							} ?>
							</p>
							<a href="<?php echo $href_link; ?>" <?php  
								if($type != "link") { ?> class="swipebox_<?php echo $PVGM_Id;?> info <?php echo $PVGM_Button_Radious;?>" alt="<?php echo $alt; ?>" <?php }else{ ?> class="info" target="<?php echo $PVGM_Open_Link; ?>" <?php } 
								?>><?php echo $PVGM_Button_Text; ?> </a>
						</div>
					</div>
				<?php } ?>
				
				</div>	
				<?php
			}
		}
		?>
	</div>
	<?php
	wp_reset_postdata();
    return ob_get_clean();
}
                    

Code file location:

photo-video-gallery-master/photo-video-gallery-master/gallery-short-code.php

Conclusion

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