常用函数-wp_attachment_is_image()

0条评论

常用函数-wp_attachment_is_image()

说明

该函数判断文章是否为图片

用法

<?php wp_attachment_is_image( $post_id ); ?>

示例

检查编号为37的文章是否是图片:

<?php    
  $id = 37    
  if ( wp_attachment_is_image( $id ) )      
    echo "Post ".$id." is an image!";    
  else      
    echo "Post ".$id." is not an image.";  
?>  

参数

$post_id

(整数)(可选)文章的整数编号

默认值:0

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.