su_shortcode_dummy_image

The shortcodes-ultimate su shortcode dummy image function.

Published Date - February 15, 2021

Description

su_shortcode_dummy_image( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

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

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

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

Defined

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

shortcodes-ultimate/includes/shortcodes/dummy-image.php

function su_shortcode_dummy_image( $atts = null, $content = null ) {
	$atts = shortcode_atts( array(
			'width'  => 500,
			'height' => 300,
			'theme'  => 'any',
			'class'  => ''
		), $atts, 'dummy_image' );
	$url = 'http://lorempixel.com/' . $atts['width'] . '/' . $atts['height'] . '/';
	if ( $atts['theme'] !== 'any' ) $url .= $atts['theme'] . '/' . rand( 0, 10 ) . '/';
	return '<img src="' . $url . '" alt="' . __( 'Dummy image', 'shortcodes-ultimate' ) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" class="su-dummy-image' . su_get_css_class( $atts ) . '" />';
}