Images: Shortcode, Nested shortcode, Example, Lightbox

I needed dummy text for a blog I'm working on, and since I like to code I wrote a simple plugin I'd like to share, you'll find it  in the WordPress Plugin Directory

 

Plugin: You’ll find the plugin at https://wordpress.org/extend/plugins/lorem-shortcode/

InstallationDownload the plugin and save it in wp-content/plugins (remember to activate in Plugins) or wp-content/mu-plugins or install it from inside WordPress in Plugins->Add New (search for “lorem shortcode”)

UsageAdd the shortcode to a Page. The plugin contains two shortcodes, [lorem] and [loremimage], the [loremimage] shortcode can be nested in the [lorem] shortcode. Supported parameters, all are optional:

[lorem]

 

  • p="3" Number of paragraphs. Default is 5
  • l="7", Number of lines per paragraph. Default is 3
  • align="right" This tells how you'd like to allign a nested shortcode. There are two alternatives, left or right. Default is right

[loremimage]

The loremimage is created using  https://dummyimage.com/, and hence the shortcode supports the same parameters as  https://dummyimage.com/

  • size="400x400" Image size. Default is 300x200.
  • text="lorem ipsum" Default is empty.
  • fgcolor="fff" Image foreground color. Default is "ccc".
  • bgcolor="ccc" Image foreground color. Default is  "eee".
  • format="png", Image format. Default is "png". 

I've added two additional parameters/values

  • size="thumb" This will create a thumbnail, size based on your WordPress image settings. The thumb links to another image and support Lightbox et al (has attribute rel="lightbox[lorem]").
  • style="padding:5px;" Default is empty

Changelog:

  • 1.1 Added support for embedded shortcodes and added the [loremimage] short code. The [loremimage] can be used by itself. The image is created using https://dummyimage.com/
  • 1.0 Initial release