Changeset 2410265
- Timestamp:
- 10/31/2020 08:26:49 AM (5 years ago)
- Location:
- thumblink
- Files:
-
- 6 edited
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-772x250.png (modified) (previous)
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
trunk/thumblink.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thumblink/trunk/thumblink.php
r2407952 r2410265 2 2 /** 3 3 * @package Thumblink 4 * @version 1. 24 * @version 1.3 5 5 */ 6 6 /* … … 9 9 Description: Thumblink automatically creates thumbnails for all of your blog posts to make your links look better. A link to your WordPress site on platforms like Facebook, Twitter, and LinkedIn is often the first interaction you have with a visitor. The link's thumbnail is 3x larger than its text preview - if it looks ugly or unmaintained, they won't click on it. Thumblink automatically generates these thumbnails by taking a screenshot of each page. 10 10 Author: Team Thumblink 11 Version: 1. 211 Version: 1.3 12 12 Author URI: https://thumblink.com/ 13 13 */ … … 15 15 global $wp; 16 16 function hook_thumblink() { 17 if (has_post_thumbnail()) { 18 $post_image = wp_get_attachment_image_src(get_post_thumbnail_id(), "full"); 19 if (!empty($post_image[0])) { 20 $post_image = $post_image[0]; 21 echo "<meta property=\"og:image\" content=\"{$post_image}\" />"; 22 return; 23 } 17 $post_title = get_the_title(); 18 echo "<meta name=\"twitter:card\" content=\"summary_large_image\" />\n"; 19 echo "<meta name=\"twitter:title\" content=\"{$post_title}\" />\n"; 20 if (has_post_thumbnail()) { 21 $post_image = wp_get_attachment_image_src(get_post_thumbnail_id(), "full"); 22 if (!empty($post_image[0])) { 23 $post_image = $post_image[0]; 24 echo "<meta name=\"twitter:image\" content=\"{$post_image}\" />\n"; 25 echo "<meta property=\"og:image\" content=\"{$post_image}\" />\n"; 26 echo "<meta property=\"og:image:secure_url\" content=\"{$post_image}\" />\n"; 27 return; 24 28 } 25 $url = get_page_link(); 26 $post = get_post(); 27 if (!is_null($post)) { 28 if(is_array($post)) { 29 $post = $post[0]; 30 } 31 $url .= "#post-{$post->ID}"; 32 } 33 $url = urlencode($url); 34 echo "<meta property=\"og:image\" content=\"https://generate.thumblink.com/?url={$url}\" />"; 29 } 30 $url = get_page_link(); 31 $post = get_post(); 32 if (!is_null($post)) { 33 if(is_array($post)) { 34 $post = $post[0]; 35 } 36 $url .= "#post-{$post->ID}"; 37 } 38 $url = urlencode($url); 39 echo "<meta name=\"twitter:image\" content=\"https://generate.thumblink.com/?url={$url}\" />\n"; 40 echo "<meta property=\"og:image\" content=\"https://generate.thumblink.com/?url={$url}\" />\n"; 41 echo "<meta property=\"og:image:secure_url\" content=\"https://generate.thumblink.com/?url={$url}\" />\n"; 35 42 } 36 43 add_action('wp_head', 'hook_thumblink');
Note: See TracChangeset
for help on using the changeset viewer.