Site preview using WordPress
Very good code for those who create a directory of sites. Now I use WordPress and without third-party scripts you can make a preview.
First you need to insert into the function.php file the code that will allow you to use the preview function directly from the content.
I used a similar code in one of the SEO services. You can also see something similar on a site that helps webmasters evaluate external factors affecting the site's search results.. www.cy-pr.com
Code Example:
1 2 3 4 5 6 7 8 9 10 11 |
function wps_screenshot($atts, $content = null) { extract(shortcode_atts(array( "screenshot" => 'https://s.wordpress.com/mshots/v1/', "url" => 'https://', "alt" => 'screenshot', "width" => '400', "height" => '300' ), $atts)); return $screen = '<img src="' . $screenshot . '' . urlencode($url) . '?w=' . $width . '&h=' . $height . '" alt="' . $alt . '"/>'; } add_shortcode("screenshot", "wps_screenshot"); |
An example of a shortcode to be used on pages and posts.
1 |
[screenshot url="https://wp-admin.com.ua" alt="wordpress code snippets for your blog" width="200" height="200"] |
An example of what happens: