su_shortcode_lightbox

The shortcodes-ultimate su shortcode lightbox function.

Published Date - February 15, 2021

Description

su_shortcode_lightbox( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_shortcode_lightbox' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/shortcodes/lightbox.php';
}

// The input(s). 
$atts = null;
$content = null;

// NOTICE! Understand what this does before running.
$result = su_shortcode_lightbox( $atts, $content );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/shortcodes/lightbox.php

function su_shortcode_lightbox( $atts = null, $content = null ) {

	$atts = shortcode_atts(
		array(
			'src'    => false,
			'type'   => 'iframe',
			'mobile' => 'yes',
			'class'  => '',
		),
		$atts,
		'lightbox'
	);

	if ( ! $atts['src'] ) {
		return su_error_message( 'Lightbox', __( 'please specify correct source', 'shortcodes-ultimate' ) );
	}

	su_query_asset( 'css', 'magnific-popup' );
	su_query_asset( 'js', 'jquery' );
	su_query_asset( 'js', 'magnific-popup' );
	su_query_asset( 'js', 'su-shortcodes' );

	return '<span class="su-lightbox' . su_get_css_class( $atts ) . '" data-mfp-src="' . su_do_attribute( $atts['src'] ) . '" data-mfp-type="' . sanitize_key( $atts['type'] ) . '" data-mobile="' . sanitize_key( $atts['mobile'] ) . '">' . do_shortcode( $content ) . '</span>';

}