Created
December 28, 2015 02:18
-
-
Save nathaningram/13b629432d9950d5d354 to your computer and use it in GitHub Desktop.
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
| //Screenshot Snap Shortcode | |
| // Usage: [snap url="http://wordpress.com" alt="WordPress" w="400" h="300" title="WordPress" descr='WordPress is awesome,'] | |
| function ni_screenshot($atts, $content = null) { | |
| extract(shortcode_atts(array( | |
| "snap" => 'http://s.wordpress.com/mshots/v1/', | |
| "url" => 'http://training.ithemes.com', | |
| "w" => '400', | |
| "h" => '300', | |
| "title" => 'Site Title', | |
| "descr" => 'Site Descrition ' | |
| ), $atts)); | |
| $img = '<div class="snap"><a href="' . $url . '" target="_blank"><img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $title . '" / class="snap-image"></a><div class="snap-title">' . $title . '</div><div class="snap-descr">' . $descr . ' </div></div> '; | |
| return $img; | |
| } | |
| add_shortcode('snap', 'ni_screenshot'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment