Created
April 22, 2014 15:01
-
-
Save jillmugge/11182615 to your computer and use it in GitHub Desktop.
Building a Shortcode for Lorempixel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://lorempixel.com/ | |
// [phpic width="300" height="200"] | |
<?php | |
function grab_random_picture($atts){ | |
extract(shortcode_atts(array( | |
'width' => 400, | |
'height' => 300, | |
), $atts)); | |
return '<img src="http://lorempixel.com/'. $width . '/' . $height . '" />'; | |
} | |
add_shortcode('phpic', 'grab_random_picture'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment