wordpress收费下载资源主题
wordpress付费下载资源插件

WordPress函数说明

1、Functions by category 分类函数,Post, Page, Attachment and Bookmarks Functions 文章,页面,附件和链接的函数

get_adjacent_post

返回邻近的文章信息数组,详情见:http://codex.wordpress.org/Function_Reference/get_adjacent_post.

get_children

检索附件、版本、子页面等信息,一般情况下由父文章执行,详情见 :http://codex.wordpress.org/Function_Reference/get_children.

get_extended

获取文章 more 标签分割的数组.$post 是文章的内容

get_next_post

获取下一篇邻近的文章信息.

get_post

返回单篇文章的信息数组或对象,$id 是文章 id,注意这里只能用变量,详情见:

http://codex.wordpress.org/Function_Reference/get_post.

get_post_ancestors

返回基于文章 ID 的父文章的信息数组.

get_post_mime_type

返回基于附件 ID 的方式类型信息.

get_post_status

返回基于文章 ID 的文章状态.

get_post_type

返回基于文章 ID 的文章类型.

get_previous_post

返回上一篇邻近的文章信息.

get_posts

获取一系列文章的集合,详情见:http://codex.wordpress.org/Template_Tags/get_posts.

is_post

已弃用.

is_single

判断是否规定的单篇日志.

is_sticky

判断文章是否置顶.

register_post_type

注册发布类型,详情见:http://codex.wordpress.org/Function_Reference/register_post_type.

wp_get_recent_posts

返回最近发布的文章数组.

wp_get_single_post

返回单篇文章的的数组或对象,同 get_post().

wp_delete_post

删除文章、页面或附件,$force_delete 为 true 时不经过回收站.

wp_insert_post

发表一篇文章或页面,详情见:

http://codex.wordpress.org/Function_Reference/wp_insert_post.

wp_publish_post

通过更改文章状态来发表文章

wp_update_post

更新一篇文章,详情见:http://codex.wordpress.org/Function_Reference/wp_update_post.

get_all_page_ids

返回所有页面的数组.

get_page

返回一个页面的对象或数组,详情见:

http://codex.wordpress.org/Function_Reference/get_page.

get_page_link

获取页面的链接,$id 是页面 ID,$leavename 判断是否允许使用页面名, $sample 判断

是否示例链接

get_page_by_path

获取一篇基于地址的页面对象或数组,$page_path 是页面地址,$output 指定输出类型是

否对象或数组,默认是对象.

get_page_by_title

获取一篇基于标题的页面对象或数组,$page_title 是页面标题, $output 是输出类型,

默认对象, $post_type 是文章类型,默认 page.

get_page_children

在编号相匹配的页面列表中检索子页面,$page_id 是父页面的 ID,$pages 是被检索的页

面数组.

get_page_hierarchy

返回一个数组,该数组按页面排序次序进行排序,$posts 是页面的集合,$parent 是父 ID.

get_page_uri

获取指定 Id 的页面 uri.

get_pages

获取页面的集合,详情见:http://codex.wordpress.org/Function_Reference/get_pages.

is_page

判断是否当前或指定的页面.

page_uri_index

为页面 URI 检索所有页面与附件。检索以页面为父级的文章的附件。

wp_list_pages

输出页面的列表,$args详情见:

http://codex.wordpress.org/Template_Tags/wp_list_pages.

add_post_meta

为 指 定 文 章 添 加 自 定 义 ( meta ) 字 段 , 详 情 见 :

http://codex.wordpress.org/Function_Reference/add_post_meta.

delete_post_meta

从 指 定 文 章 中 删 除 含 有 指 定 关 键 字 的 所 有 自 定 义 字 段 , 详 情 见 :

http://codex.wordpress.org/Function_Reference/delete_post_meta.

get_post_custom

返回指定文章的自定义字段.

get_post_custom_keys

获取指定文章的自定义字段名.

get_post_custom_values

获取指定文章的自定义字段名的值.

get_post_meta

返 回 指 定 文 章 中 含 有 指 定 关 键 字 自 定 义 字 段 的值 , 详情见 :http://codex.wordpress.org/Function_Reference/get_post_meta.

update_post_meta

为指定文章更新自定义(meta)字段.

get_attached_file

获取一个附件的地址.$attachment_id 是附件的 ID, $unfiltered 判断是否使用过滤器.

is_attachment

判断附件是否被显示.

is_local_attachment

判断 url 地址是否为本地的附件.

update_attached_file

更新一个附件. $file 是附件地址

wp_attachment_is_image

判断指定的附件是否为图片.

wp_insert_attachment

为指定的页面插入一个附件,详情见:

http://codex.wordpress.org/Function_Reference/wp_insert_attachment.

wp_delete_attachment

删除指定的附件,$postid 是附件 ID,$force_delete 为 true 时不经过回收站.

wp_get_attachment_image

返回一个附件的 html,$attachment_id 是附件 ID,$size 是(thumbnail, medium, large or

full),$icon 是替代的图标地址.

wp_get_attachment_image_src

返回一个附件的 src,$attachment_id 是附件 ID,$size 是(thumbnail, medium, large or full),

$icon 是替代的图标地址.(by mobantu.com)

wp_get_attachment_metadata

返回一个附件的元数据,$post_id 是附件 ID,$unfiltered 判断是否使用过滤器.

wp_get_attachment_thumb_file

获取附件的缩略图地址.

wp_get_attachment_thumb_url

获取附件缩略图地址.

wp_get_attachment_url

获取附件的 url.

wp_check_for_changed_slugs

检查已发表文章中经改动的缩略名并保存原有缩略名.

wp_count_posts

输出文章的统计数组,type 为文章类型,’readable’是可读性.

wp_mime_type_icon

检索 MIME 类型的图标.

wp_update_attachment_metadata

更新指定附件的 MIME 类型.

get_bookmark

获取一个链接的数组. $bookmark 是书签 ID, $output 是输出方式(OBJECT, ARRAY_N, or

ARRAY_A).

get_bookmarks

返回书签的数组.$args详情见:

http://codex.wordpress.org/Function_Reference/get_bookmarks.

wp_list_bookmarks

输出书签的数组.$args

http://codex.wordpress.org/Template_Tags/wp_list_bookmarks.

相关废弃标签: get_links_list() 和 get_links().

wp_get_post_categories

返回文章的类型 ID 数组.

wp_set_post_categories

设置文章分类 ID.

wp_get_post_tags

获取文章的标签 ID.

wp_set_post_tags

设置文章的标签,$tags 是要添加的标签字符串数组,$append 默认为 false 覆盖已有标签,true 为添加.

wp_get_post_terms

获取文章的分类法数组, 默认是’post_tag’.

wp_set_post_terms

设置文章的分类法,$tags 是要添加的标签字符串数组,$taxonomy 是分类方法,默认’post_tag’,$append 默认为 false 覆盖已有标签,true 为添加.

add_meta_box

插件开发者可通过该函数在 Write Post,Write Page 和 Write Link 编辑页面内添加版块.详情见:http://codex.wordpress.org/Function_Reference/add_meta_box.

get_the_ID

返回当前文章的 ID.

get_the_author

获取文章的作者 ID.

get_the_content

获取文章的内容,$more_link_text 是更多的链接文字, $stripteaser 在更多内容前显示内容摘要, $more_file 可选,不使用.

wp_trim_excerpt

必要时为文章生成内容摘要. 摘要应在 55 字以内,如果总字数多于该数目,摘要结尾应添加字符串’[...]‘。如果少于 55 个字符,显示摘要全文。

0 个评论

定制开发
本站承接WordPress等系统建站仿站、二次开发、主题插件定制等开发服务
在线咨询
  • 请直接说明需求,勿问在否
    QQ:1-247-246-247

  • QQ一群:104228692(满)
  • QQ二群:64786792
在线咨询
本站承接WordPress建站仿站、二次开发、主题插件定制等PHP开发服务!

了解详情