һ
 ע

QQ¼

ֻһٿʼ

ƼĶ

+

[WordPress] WordPressȡеͼƬķ

[]
16441 websjy 2014-9-23 21:01:24
| ʾȫ¥
1F

ϵ½עᣬύѣø๦ܣϴزIJޣ

Ҫ ¼ ſػ鿴ûʺţע  

x
xiuΪṩһĹܾʾһƪеͼƬȤ˸ϸĶַҸùܵĺ

´뵽ǰʹfunctions.phpļУȻбѭҳеøúɡ

עxiuиùܡ

WordPressȡеͼƬ

  1. /*
  2. * ȡеͼƬ ʹбѭСҳУ
  3. */
  4. if( !function_exists('get_post_images_number') ){
  5.         function get_post_images_number(){
  6.             global $post;
  7.             $content = $post->post_content;  
  8.             preg_match_all('/<img.*?(?: |\\t|\\r|\\n)?src=[\'"]?(.+?)[\'"]?(?:(?: |\\t|\\r|\\n)+.*?)?>/sim', $content, $result, PREG_PATTERN_ORDER);  
  9.             return count($result[1]);  
  10.         }
  11. }
ƴ

ʹ÷


  1. <?php echo get_post_images_number().'ͼƬ' ?>
ƴ


Դ΢http://weibo.com/techued Դ΢Źںţweb-tech
ʹõ ٱ ظ
ݼ6446 2015-1-4 14:53:54
| ʾȫ¥
2F
Ҫ,¥ͷDz
Դ΢http://weibo.com/techued Դ΢Źںţweb-tech
ʹõ ٱ ظ ֧
б

ֹ

̳¡ͼƬѷϴվԭתԻ,µİȨԭ
վַİȨ֪ͨǵĹԱ,Ա(Email:admin@websjy.com)ʱȡȨɾ
ܾκκʽڱ̳л񹲺͹ִ!

QQ| 42011102000510|Archiver|ֻ|Դ ( ICP14013341-1

GMT+8, 2018-9-26 07:13

Powered by Discuz! X3.2

ԴԴվ  ԴAPPӦ֮

ٻظ ض б