Changeset 514836
- Timestamp:
- 03/05/2012 06:26:12 PM (14 years ago)
- Location:
- simplicy-post-view/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
simplicy-post-view.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simplicy-post-view/trunk/readme.txt
r492207 r514836 36 36 == Changelog == 37 37 38 = Version 1.0 (21/05/2011) =<br /> = Version 1.1 (27/06/2011) =<br /> = Version 1.2 (28/10/2011) = = Fixed minor bugs and add css style sheet= <br />= Version 1.3 (18/11/2011) = = Fixed minor bugs = <br />= Version 1.4 (3/12/2011) = = Fixed bugs Excerpt = 39 <br />= Version 1.5 (16/12/2011) = = adding option Select all category <br /> Version 1.6 (11/01/2012) = = Fixed bugs excerpt <br /> Version 1.7 (19/01/2012) = = change function excerpt 38 = Version 1.0 (21/05/2011) =<br /> = Version 1.1 (27/06/2011) =<br /> = Version 1.2 (28/10/2011) = Fixed minor bugs and add css style sheet= <br />= Version 1.3 (18/11/2011) = = Fixed minor bugs = <br />= Version 1.4 (3/12/2011) = = Fixed bugs Excerpt = 39 <br />= Version 1.5 (16/12/2011) = adding option Select all category <br /> Version 1.6 (11/01/2012) = Fixed bugs excerpt <br /> Version 1.7 (19/01/2012) = = change function excerpt <br /> 40 Version 1.8 (5/03/2012) = change function URL attachement image post 40 41 -
simplicy-post-view/trunk/simplicy-post-view.php
r492694 r514836 2 2 /* 3 3 * Plugin Name: Simplicy post view 4 * Version: 1. 74 * Version: 1.8 5 5 * Plugin URI: http://plugins.svn.wordpress.org/simplicy-post-view/ 6 6 * Description: afficher vos article avec miniature dans votre sidebar. … … 226 226 227 227 228 function vp_get_thumbs_url( $text)228 function vp_get_thumbs_url() 229 229 { 230 global $post; 231 232 $imageurl=""; 233 234 // extract the thumbnail from attached imaged 235 $allimages =&get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post->ID ); 236 237 foreach ($allimages as $img){ 238 $img_src = wp_get_attachment_image_src($img->ID); 239 break; 240 } 241 242 $imageurl=$img_src[0]; 243 244 245 // try to get any image 246 if (!$imageurl) 247 { 248 preg_match('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i' , $text, $matches); 249 $imageurl=$matches[1]; 250 } 251 252 // try to get youtube video thumbnail 253 if (!$imageurl) 254 { 255 preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $text, $matches2); 256 257 $youtubeurl = $matches2[0]; 258 if ($youtubeurl) 259 $imageurl = "http://i.ytimg.com/vi/{$matches2[3]}/1.jpg"; 260 else preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/(v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $text, $matches2); 261 262 $youtubeurl = $matches2[0]; 263 if ($youtubeurl) 264 $imageurl = "http://i.ytimg.com/vi/{$matches2[3]}/1.jpg"; 265 } 266 267 268 return $imageurl; 230 global $post, $posts; 231 232 $first_img = ''; 233 234 if(has_post_thumbnail() ) { 235 236 $image_id = get_post_thumbnail_id(); 237 238 $image_url = wp_get_attachment_image_src($image_id,'large'); 239 240 $image_url = $image_url[0]; 241 242 $first_img = $image_url ; 243 244 } 245 246 if(!has_post_thumbnail() ) { 247 248 if( get_post_meta($post->ID, 'articleimg', true)) { 249 250 $first_img = get_post_meta($post->ID, 'articleimg', true); 251 252 } 253 254 // no field 255 256 if(empty($first_img)){ 257 258 ob_start(); 259 260 ob_end_clean(); 261 262 $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); 263 264 $first_img = $matches [1] [0]; 265 266 } 267 268 } 269 270 return $first_img; 269 271 } 270 272
Note: See TracChangeset
for help on using the changeset viewer.