Ask questions about WordPress courses

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:

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 = '' . $alt . '';
}
add_shortcode("screenshot", "wps_screenshot");

An example of a shortcode to be used on pages and posts.

wordpress code snippets for your blog 

An example of what happens:

wordpress code snippets for your blog

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal