完整的WordPress函数大全
wordpress函数说明(已汉化中文)

获取文章的标签ID.
get_the_content
获取文章的内容,$more_link_text 是更多的链接文字, $stripteaser 在更多内容前显示内容摘要, $more_file 可选,不使用.
wp_trim_excerpt
必要时为文章生成内容摘要. 摘要应在55字以内,如果总字数多于该数目,摘要结尾应添加字符串’[...]‘。如果少于55个字符,显示摘要全文。
wp_get_attachment_image_src
返回一个附件的src,$attachment_id是附件ID,$size是(thumbnail, medium, large or full),$icon 是替代的图标地址.
wp_get_attachment_metadata
返回一个附件的元数据,$post_id是附件ID,$unfiltered判断是否使用过滤器.
wp_get_recent_posts
返回最近发布的文章数组.
wp_get_single_post
返回单篇文章的的数组或对象,同get_post().
wp_delete_post
删除文章、页面或附件,$force_delete为true时不经过回收站.
wp_insert_post
is_post
已弃用.
is_single
判断是否规定的单篇日志.
is_sticky
判断文章是否置顶.
register_post_type
注册发布类型,详情见:/Function_Reference/register_post_type.
wp_delete_attachment
wordpress常用标签调用代码大全

和之间的PHP代码网站标题日志或页面标题WordPress主题样式表文件style.css的相对地址WordPress博客的Pingback地址WordPress主题文件的相对地址博客的Wordpress版本WordPress博客的Atom地址WordPress博客的RSS2地址WordPress博客的绝对地址WordPr ess博客的名称网站的HTML版本网站的字符编码格式WordPress 主体模板PHP代码日志内容确认是否有日志如果有,则显示全部日志结束PHP函数”while”结束PHP函数”if”header.php文件的内容sidebar.php文件的内容footer.php文件的内容显示格式为”02-19-08″的日期显示一篇日志的留言链接显示一篇日志或页面的标题显示一篇日志或页面的永久链接/URL地址显示一篇日志或页面的所属分类显示一篇日志或页面的作者显示一篇日志或页面的ID显示一篇日志或页面的编辑链接显示Blogroll中的链接comments.php文件的内容显示一份博客的页面列表显示一份博客的分类列表下一篇日志的URL地址上一篇日志的URL地址调用日历显示一份博客的日期存档列表显示较新日志链接(上一页)和较旧日志链接(下一页)显示博客的描述信息其它的一些Wordpress模板代码/%postname%/ 显示博客的自定义永久链接搜索表单的值打印输出信息显示注册链接显示登入/登出链接在日志或页面中插入分页截断日志显示管理员的相关控制信息显示载入页面的时间显示载入页面查询1. wordpress调用最新文章WordPress最新文章的调用可以使用一行很简单的模板标签wp_get_archvies来实现. 代码如下:(显示10篇最新更新文章)或者后面这个代码显示你博客中最新的20篇文章,其中format=custom这里主要用来自定义这份文章列表的显示样式。
具体的参数和使用方法你可以参考官方的使用说明- wp_get_archvies。
wp函数运算公式示例

wp函数运算公式示例
以下是WP表格中常用函数的运算公式示例:
1.SUM函数:SUM函数用于求和,可以计算连续区域或不连续区域单元格的数值之和。
例如,在单元格A1中输入公式=SUM(B1:B10),可以将B1到B10单元格中的数值相加。
2.COUNT函数:COUNT函数用于计数,可以计算单元格区域或数字数组中数字字段的输入项个数。
例如,在单元格A1中输入公式=COUNT(B1:B10),可以统计B1到B10单元格中数字的数量。
3.COUNTIF函数:COUNTIF函数用于对满足特定条件的单元格进行计数。
例如,在单元格A1中输入公式
=COUNTIF(B1:B10,">50"),可以统计B1到B10单元格中数值大于50的数量。
4.AVERAGE函数:AVERAGE函数用于计算平均值,可以计算连续区域或不连续区域单元格内的数值之和,然后除以单元格的数量。
例如,在单元格A1中输入公式
=AVERAGE(B1:B10),可以计算B1到B10单元格中的平均值。
5.MAX函数:MAX函数用于找出最大值,可以计算连续区域或不连续区域单元格中的最大值。
例如,在单元格A1中输入公式=MAX(B1:B10),可以找出B1到B10单元格中的最大值。
6.MIN函数:MIN函数用于找出最小值,可以计算连续区域或不连续区域单元格中的最小值。
例如,在单元格A1中输入公式=MIN(B1:B10),可以找出B1到B10单元格中的最小值。
以上示例可以帮助您理解WPS表格中常用的函数运算公式,具体使用时需要根据实际情况进行修改和调整。
wordpress模板标签函数大全二次开发手册

1.根据分类来制定导航条2.删除控制面板首页多余的板块3.显示所有最新的文章4.发表文章时对文章进行修改的操作一套完整的WordPress模板应至少具有如下文件:style.css : CSS(样式表)文件index.php : 主页模板archive.php : Archive/Category模板404.php : Not Found 错误页模板comments.php : 留言/回复模板footer.php : Footer模板header.php : Header模板sidebar.php : 侧栏模板page.php : 内容页(Page)模板single.php : 内容页(Post)模板searchform.php : 搜索表单模板search.php : 搜索结果模板当然,具体到特定的某款模板,可能不止这些文件,但一般而言,这些文件是每套模板所必备的。
基本条件判断Tagis_home() : 是否为主页is_single() : 是否为内容页(Post)is_page() : 是否为内容页(Page)is_category() : 是否为Category/Archive页is_tag() : 是否为Tag存档页is_date() : 是否为指定日期存档页is_year() : 是否为指定年份存档页is_month() : 是否为指定月份存档页is_day() : 是否为指定日存档页is_time() : 是否为指定时间存档页is_archive() : 是否为存档页is_search() : 是否为搜索结果页is_404() : 是否为“HTTP 404: Not Foun d” 错误页is_paged() : 主页/Category/Archive页是否以多页显示Header部分常用到的PHP函数<?php blog info(‟name‟); ?> : 博客名称(Title)<?php bloginfo(‟stylesheet_url‟); ?> : CSS文件路径<?php bloginfo(‟pingback_url‟); ?> : PingBack Url<?php bloginfo(‟template_url‟); ?> : 模板文件路径<?php bloginfo(‟version‟); ?> : WordPress版本<?php bloginfo(‟atom_url‟); ?> : Atom Url<?php bloginfo(‟rss2_url‟); ?> : RSS 2.o Url<?php bloginfo(‟url‟); ?> : 博客Url<?php bloginfo(‟html_type‟); ?> : 博客网页Html类型<?php bloginfo(‟charset‟); ?> : 博客网页编码<?php bloginfo(‟description‟); ?> : 博客描述<?php wp_title(); ?> : 特定内容页(Post/Page)的标题模板常用的PHP函数及命令<?php get_header(); ?> : 调用Header模板<?php get_sidebar(); ?> : 调用Sidebar模板<?php get_footer(); ?> : 调用Footer模板<?php the_content(); ?> : 显示内容(Post/Page)<?php if(have_posts()) : ?> : 检查是否存在Post/Page<?php while(have_posts()) : the_post(); ?> : 如果存在Post/Page则予以显示<?php endwhile; ?> : While 结束<?php endif; ?> : If 结束<?php the_time(‟字符串‟) ?> : 显示时间,时间格式由“字符串”参数决定,具体参考PHP手册<?php comments_popup_link(); ?> : 正文中的留言链接。
WORDPRESS函数使用说明

WORDPRESS函数使用说明WordPress是一个非常流行的开源内容管理系统(CMS),它提供了丰富的功能和灵活的扩展性,使得用户可以轻松创建和管理自己的网站。
WordPress的功能主要是通过函数调用来实现的,函数提供了许多方便的方法来完成各种任务,包括创建页面、发布文章、添加插件、更改主题等。
在这篇文章中,我们将详细介绍一些常用的WordPress函数,以及它们的使用说明。
1. get_header(和get_footer(: 这两个函数用于在页面中引入网站的头部和底部。
可以将它们放置在页面的适当位置,以保证每个页面都有一致的布局和样式。
2. bloginfo(: 这个函数用于输出网站的基本信息,比如网站的名称、描述、URL等。
可以使用不同的参数来获取不同的信息,比如bloginfo('name')将输出网站的名称,bloginfo('description')将输出网站的描述。
3. wp_nav_menu(: 这个函数用于创建自定义菜单。
可以通过在WordPress后台创建菜单,并给菜单分配位置,然后使用wp_nav_menu(函数将菜单输出到指定位置。
4. get_sidebar(: 这个函数用于引入侧边栏的内容。
可以将它放置在页面的适当位置,以显示一些附加的信息、小工具或广告。
6. the_loop(: 这个函数用于循环输出查询结果。
通常配合wp_query(函数一起使用,可以在循环中使用其他函数来输出文章的标题、内容、缩略图等信息。
7. get_permalink(: 这个函数用于获取文章或页面的永久链接。
可以使用这个函数来生成自定义的链接,比如在文章列表中添加“阅读全文”链接。
8. the_title(和the_content(: 这两个函数分别用于输出文章或页面的标题和内容。
可以将它们放置在循环中,以逐个输出查询结果。
9. the_post_thumbnail(: 这个函数用于输出文章或页面的特色图像。
WordPress分类函数get_categories(获得分类所有信息)-推荐下载

用get_categories()函数代替wp_list_categories()灵活显示分类列表的例子我们在开发wordpres主题时一般都是wp list categories()显示分类列表,但是有时我们不想要class,title之类的,那么我们可以用wordpress中的get_categories()定制自己的样式,例如下面的例子就可以生成我们需要的最简单样式,当然你还可以按自己的要求编写get_categories()函数可以获得分类所有信息,返回与查询参数相匹配的类别对象数组。
变量与wp_list_categories基本一致,且变量可被作为数组传递,也可在查询句法中被传递。
函数说明用法:参数说明∙type(字符)post和link 其中link在新版3.0以后已被弃用。
∙child_of(整数)仅显示标注了编号的分类的子类。
该参数无默认值。
使用该参数时应将hide_empty 参数设为false∙parent(整数)只显示某个父级分类以及下面的子分类(注:子分类只显示一个层级)。
∙orderby(字符)将分类按字母顺序或独有分类编号进行排序。
默认为按分类编号排序包括ID(默认)和Name∙order(字符)为类别排序(升序或降序)。
默认升序。
可能的值包括asc(默认)和desc∙hide_empty(布尔值)触发显示没有文章的分类。
默认值为true(隐藏空类别)。
有效的值包括:1(true)和0(false)。
∙hierarchical(布尔值)将子类作为内部列表项目(父列表项下)的层级关系。
默认为true(显示父列表项下的子类)。
有效值包括1 (true)和0(false)∙exclude(字符)除去分类列表中一个或多个分类,多个可以用逗号分开,用分类ID号表示。
∙include(字符)只包含指定分类ID编号的分类。
多个可以用逗号分开,用分类ID号表示。
∙pad_counts(布尔值)通过子类中的项来计算链接或文章。
遍历 obregistercallbacks 的回调函数-概述说明以及解释

遍历obregistercallbacks 的回调函数-概述说明以及解释1.引言1.1 概述引言部分的概述旨在介绍读者对于接下来要讨论的话题有一个整体的认识。
在本篇文章中,我们将深入探讨obregistercallbacks 这个函数的回调函数,介绍其作用、遍历方法和回调函数的重要性。
通过分析这些内容,读者可以更加全面地了解如何有效地利用这些功能来实现程序的高效性和可维护性。
通过本文的阐述,读者将能够掌握关于obregistercallbacks 的回调函数的相关知识,为日后的实际应用提供参考和指导。
1.2文章结构1.2 文章结构本文将分为三个主要部分:引言、正文和结论。
引言部分将介绍obregistercallbacks 的概念和作用,以及本文的目的。
正文部分将深入探讨obregistercallbacks 的作用、遍历obregistercallbacks 的方法以及回调函数的重要性。
结论部分将总结本文的主要观点,并探讨obregistercallbacks 在实际应用中的场景和未来发展的展望。
通过这三个部分的内容,读者将能够全面了解obregistercallbacks 的特点和作用,以及如何有效地使用和管理其回调函数。
"1.3 目的":本文的目的是深入探讨obregistercallbacks 的回调函数,并介绍遍历这些回调函数的方法。
通过本文的阐述,读者将能够清晰地了解obregistercallbacks在代码中的作用和重要性,掌握如何利用回调函数来实现特定功能。
同时,本文还将分析回调函数在实际应用场景中的作用,以及展望未来回调函数的发展趋势,帮助读者更好地应用和理解这一重要的编程概念。
通过全面而深入的研究,读者将能够更好地掌握回调函数的使用方法,提高代码的可读性和可维护性,从而在实践中更好地运用这一技术。
2.正文2.1 obregistercallbacks 的作用obregistercallbacks 是一个函数,它的作用是注册一个或多个回调函数,这些回调函数会在特定事件发生时被调用。
wordpress函数大全列表整理

wordpress函数⼤全列表整理wordpress有很多的函数可供调⽤,下⾯ytkah就整理了⼀下wordpress函数⼤全供各位参考,如果要详情,可以访问https:///reference/functions/参数名/,感兴趣的朋友可以收藏⽂章,页⾯,附件,书签⽂章get_adjacent_postget_boundary_postget_childrenget_extendedget_next_postget_next_posts_linknext_posts_linkget_permalinkthe_permalinkget_the_excerptthe_excerptget_the_post_thumbnailget_postget_post_fieldget_post_ancestorsget_post_mime_typeget_post_statusget_post_formatset_post_formatget_delete_post_linkget_previous_postget_previous_posts_linkprevious_posts_linkhave_postsis_post(不赞成)is_singleis_stickyget_the_IDthe_IDthe_postwp_get_recent_postswp_get_single_posthas_post_thumbnailhas_excerpthas_post_format⾃定义⽂章状态register_post_status⾃定义⽂章类型register_post_typeis_post_type_archivepost_type_archive_titleadd_post_type_supportremove_post_type_supportpost_type_supportsset_post_typepost_type_existsget_post_typeget_post_typesget_post_type_archive_linkget_post_type_objectget_post_type_capabilitiesget_post_type_labelsis_post_type_hierarchical⽂章插⼊/移除lwp_delete_postwp_insert_postwp_publish_postwp_trash_postwp_update_post页⾯get_all_page_idsget_ancestorsget_page(不赞成)get_page_linkget_page_by_pathget_page_by_titleget_page_childrenget_page_hierarchyget_page_uriget_pagesis_pagepage_uri_indexwp_link_pageswp_dropdown_pages⾃定义域 (⽂章信息 postmeta)add_post_metadelete_post_metaget_post_customget_post_custom_keysget_post_custom_valuesget_post_metaupdate_post_metaregister_meta附件get_attached_fileimage_resize(不赞成)is_attachmentis_local_attachmentset_post_thumbnailupdate_attached_filewp_attachment_is_imagewp_create_thumbnail(不赞成)wp_insert_attachmentwp_delete_attachmentwp_get_attachment_imagewp_get_attachment_linkwp_get_attachment_image_srcwp_get_attachment_metadatawp_get_attachment_thumb_filewp_get_attachment_thumb_urlwp_get_attachment_urlwp_check_for_changed_slugswp_count_postswp_get_mime_typeswp_mime_type_iconwp_generate_attachment_metadata wp_prepare_attachment_for_jswp_update_attachment_metadata 书签(链接)get_bookmarkget_bookmarkswp_get_post_categories条件项wp_set_post_categorieswp_get_post_tagswp_set_post_tagswp_get_post_termswp_set_post_termswp_count_termshas_termis_object_in_term其他add_meta_boxremove_meta_boxget_the_IDthe_IDget_the_authorthe_authorget_the_author_posts get_the_contentthe_contentget_the_titlethe_titlethe_title_attributewp_trim_excerptwp_get_post_revision wp_get_post_revisions wp_is_post_revision paginate_links分类,标签,分类法分类cat_is_ancestor_ofget_all_category_idsget_ancestorsget_cat_IDget_cat_nameget_categoriesget_categoryget_category_by_path get_category_by_slug get_the_category_by_ID get_the_category_list get_category_linkget_category_parents get_the_categorysingle_cat_titlein_categoryis_categorythe_categorywp_category_checklist wp_dropdown_categories wp_list_categories分类创建wp_create_categorywp_delete_categorywp_insert_category标签get_tagget_tag_linkget_tagsget_the_tag_listget_the_tagshas_tagis_tagthe_tagssingle_tag_titletag_descriptionwp_generate_tag_cloud wp_tag_cloud分类法get_object_taxonomiesget_edit_term_linkget_edit_term_linkget_taxonomyget_taxonomiesget_termget_the_term_listget_term_bythe_termsget_the_termsget_term_childrenget_term_linkget_termsis_taxonomyis_taxonomy_hierarchicalis_term(不赞成)taxonomy_existsterm_existsregister_taxonomyregister_taxonomy_for_object_type wp_get_object_termswp_remove_object_termswp_set_object_termswp_insert_termwp_update_termwp_delete_termwp_terms_checklist⽤户、作者及权限权限add_capadd_roleauthor_cancurrent_user_cancurrent_user_can_for_blogget_roleget_super_adminsis_super_adminmap_meta_capremove_capremove_roleuser_can⽤户和作者auth_redirectcount_userscount_user_postscount_many_users_postsemail_existsget_currentuserinfoget_current_user_idget_profile(不赞成)get_user_byget_userdataget_usernumposts(不赞成)get_usersset_current_user(不赞成)user_pass_ok(不赞成)wp_authenticateusername_existsvalidate_usernamewp_dropdown_userswp_get_current_userwp_set_current_userwp_set_passwordget_author_posts_urlget_the_modified_authoris_multi_author⽤户 metaadd_user_metadelete_user_metaget_user_metaupdate_user_metaget_the_author_meta⽤户添加和删除wp_create_userwp_delete_userwp_insert_userwp_update_user登录和注销is_user_logged_inwp_login_formwp_signonwp_logoutwp_loginout供稿(Feed)bloginfo_rsscomment_author_rsscomment_linkcomment_text_rssdo_feeddo_feed_atomdo_feed_rdfdo_feed_rssdo_feed_rss2fetch_feedfetch_rss(不赞成)get_author_feed_linkget_bloginfo_rssget_category_feed_linkget_comment_linkget_comment_author_rssget_post_comments_feed_link get_rss(不赞成)get_search_comments_feed_link get_search_feed_linkget_the_category_rssget_the_title_rsspost_comments_feed_linkrss_enclosurethe_title_rssthe_category_rssthe_content_rss(不赞成)the_excerpt_rsswp_rss(不赞成)评论,通知和引⽤(Ping,Trackback) add_pingadd_comment_metacheck_commentcomment_textcomment_formcomments_numberdiscover_pingback_server_uri delete_comment_metado_all_pingsdo_enclosedo_trackbacksgeneric_pingget_approved_commentsget_avatarget_commentget_comment_textget_comment_metaget_commentswp_list_commentsget_enclosedget_lastcommentmodifiedget_pungget_to_pinghave_commentsget_comment_authoris_trackbackpingbackprivacy_ping_filtersanitize_comment_cookies trackbacktrackback_urltrackback_url_listupdate_comment_metaweblog_pingwp_allow_commentwp_count_commentswp_delete_commentwp_filter_commentwp_get_comment_statuswp_get_current_commenterwp_insert_commentwp_new_commentwp_set_comment_statuswp_throttle_comment_floodwp_update_commentwp_update_comment_countwp_update_comment_count_now 评论循环comment_classcomment_IDcomment_authorcomment_datecomment_timeget_comment_dateget_comment_time评论分页paginate_comments_links previous_comments_linknext_comments_linkget_comment_pages_count远程(remote)wp_remote_getwp_remote_retrieve_bodywp_get_http_headerswp_remote_fopen动作(Action),过滤器(Filter)和插件过滤器has_filteradd_filterapply_filtersapply_filters_ref_arraycurrent_filtermerge_filtersremove_filterremove_all_filters动作has_actionadd_actiondo_actiondo_action_ref_arraydid_actionremove_actionremove_all_actions插件plugin_basenameplugins_urlget_plugin_dataget_admin_page_titleplugin_dir_pathregister_activation_hookregister_deactivation_hookmenu_page_urlis_plugin_activeis_plugin_active_for_networkis_plugin_inactiveis_plugin_pageadd_contextual_help(不赞成)get_plugins⼩⼯具is_active_widgetregister_widgetthe_widgetunregister_widgetwp_add_dashboard_widgetwp_convert_widget_settingswp_get_sidebars_widgets(不赞成)wp_get_widget_defaultswp_register_sidebar_widgetwp_register_widget_controlwp_set_sidebars_widgets(不赞成)wp_unregister_sidebar_widgetwp_unregister_widget_controlwp_widget_description设置register_settingunregister_settingsettings_fieldsdo_settings_fieldsdo_settings_sectionsadd_settings_fieldadd_settings_sectionadd_settings_errorget_settings_errorssettings_errors短标签add_shortcodedo_shortcodedo_shortcode_tag(不赞成)get_shortcode_regexremove_shortcoderemove_all_shortcodesshortcode_attsshortcode_parse_attsstrip_shortcodes主题相关Include 函数comments_templateget_footerget_headerget_sidebarget_search_form其他函数add_custom_backgroundadd_custom_image_header(不赞成)add_image_sizeadd_theme_supportbody_classcurrent_theme_supportsdynamic_sidebarget_404_templateget_archive_templateget_attachment_templateget_author_templateget_body_classget_category_templateget_comments_popup_templateget_current_themeget_date_templateget_header_imageget_header_textcolorget_home_templateget_locale_stylesheet_uriget_page_templateget_paged_templateget_post_classget_query_templateget_search_templateget_single_templateget_stylesheetget_stylesheet_directoryget_stylesheet_directory_uriget_stylesheet_uriget_tag_templateget_taxonomy_templateget_templateget_template_directoryget_template_directory_uriget_template_partget_theme(不赞成)wp_get_themesget_theme_data(不赞成)get_theme_supportget_theme_modget_theme_modsget_theme_rootget_theme_rootsget_theme_root_uriget_themes(不赞成)has_header_imageheader_imageheader_textcolorin_the_loopis_child_themeis_active_sidebaris_admin_bar_showingis_customize_previewis_dynamic_sidebarlanguage_attributesload_templatelocale_stylesheetlocate_templatepost_classpreview_themepreview_theme_ob_filter preview_theme_ob_filter_callback register_nav_menuregister_nav_menusget_registered_nav_menuswp_create_nav_menuregister_sidebarregister_sidebarsregister_theme_directory remove_theme_modremove_theme_modsremove_theme_supportrequire_if_theme_supports search_theme_directoriesset_theme_modswitch_themevalidate_current_theme unregister_nav_menu unregister_sidebarwp_add_inline_stylewp_clean_themes_cachewp_get_archiveswp_get_nav_menu_itemswp_get_themewp_nav_menuwp_oembed_remove_provider wp_page_menuwp_title格式化(Formatting)absintadd_magic_quotes addslashes_gpcantispambotattribute_escapebackslashitbalanceTagsclean_preclean_url(不赞成)convert_charsconvert_smiliesent2ncresc_attresc_htmlesc_jsesc_textareaesc_sqlesc_urlesc_url_rawforce_balance_tagsformat_to_editformat_to_post(不赞成)funky_javascript_fix htmlentities2is_emailjs_escape(不赞成)make_clickablepopuplinksremove_accentssanitize_emailsanitize_file_namesanitize_html_classsanitize_keysanitize_mime_type sanitize_optionsanitize_sql_orderby sanitize_text_fieldsanitize_titlesanitize_title_for_query sanitize_title_with_dashes sanitize_userseems_utf8stripslashes_deep trailingslashit untrailingslashiturlencode_deepurl_shortenutf8_uri_encodewpautopwptexturizewp_filter_kseswp_filter_post_kseswp_filter_nohtml_kseswp_iso_descramblerwp_kseswp_kses_array_lcwp_kses_attrwp_kses_bad_protocolwp_kses_bad_protocol_once wp_kses_bad_protocol_once2 wp_kses_check_attr_valwp_kses_decode_entitieswp_kses_hairwp_kses_hookwp_kses_html_errorwp_kses_js_entitieswp_kses_no_nullwp_kses_normalize_entities wp_kses_normalize_entities2 wp_kses_splitwp_kses_split2wp_kses_strip_slasheswp_kses_versionwp_make_link_relativewp_normalize_pathwp_rel_nofollowwp_richedit_prewp_specialcharswp_trim_wordszeroisecurrent_timedate_i18nget_calendarget_date_from_gmtget_lastpostdateget_lastpostmodifiedget_day_linkget_gmt_from_dateget_month_linkthe_dateget_the_datethe_timeget_the_timethe_modified_timeget_the_modified_timeget_weekstartendget_year_linkhuman_time_diffiso8601_timezone_to_offset iso8601_to_datetime mysql2date序列化is_serializedis_serialized_string maybe_serializemaybe_unserialize选项add_optionadd_site_optiondelete_optiondelete_site_optionform_optionget_alloptions(不赞成)get_site_optionget_site_urlget_admin_urlget_user_optionget_optionupdate_optionupdate_site_option update_user_optionwp_load_alloptions Transientsset_transientget_transientdelete_transientset_site_transientget_site_transientdelete_site_transient后台菜单add_menu_pageremove_menu_pageadd_submenu_page remove_submenu_page add_object_pageadd_utility_pageadd_comments_pageadd_dashboard_pageadd_links_pageadd_management_page add_media_pageadd_options_pageadd_pages_pageadd_plugins_pageadd_posts_pageadd_theme_pageadd_users_page⼯具栏add_groupget_nodeget_nodes表单帮助checkeddisabledselectedsubmit_buttonget_submit_buttonNonces and Refererscheck_admin_referercheck_ajax_refererwp_create_noncewp_explain_nonce(不赞成)wp_get_original_refererwp_get_refererwp_nonce_ayswp_nonce_fieldwp_nonce_urlwp_original_referer_fieldwp_referer_fieldwp_send_jsonwp_send_json_errorwp_send_json_successwp_verify_nonceXMLRPCxmlrpc_getpostcategory xmlrpc_getposttitlexmlrpc_removepostdatauser_pass_ok(不赞成)本地化___x_n_nx_e_ex__ngettextesc_attr__esc_attr_eget_localeload_default_textdomain load_plugin_textdomainload_textdomainload_theme_textdomainis_rtl定时spawn_cronwp_clear_scheduled_hook wp_cronwp_get_schedulewp_get_scheduleswp_next_scheduledwp_reschedule_eventwp_schedule_eventwp_schedule_single_event wp_unschedule_eventwp_dequeue_scriptwp_dequeue_stylewp_deregister_scriptwp_deregister_stylewp_enqueue_scriptwp_enqueue_stylewp_localize_scriptwp_register_scriptwp_register_stylewp_script_iswp_style_isSQLget_tax_sqlget_meta_sqlget_posts_by_author_sql杂项add_editor_styleadd_query_argadmin_urlbool_from_yncache_javascript_headers capital_P_dangitclean_blog_cachecontent_urldo_robotsflush_rewrite_rulesget_bloginfoget_num_queriesget_post_statiget_post_statusesget_query_varhome_urlincludes_urlis_blog_installedis_main_siteis_main_queryis_multisiteis_sslis_wp_errorlog_app(不赞成)make_url_footnote(不赞成)network_admin_url network_home_urlnetwork_site_urlnocache_headersplugin_dir_urlquery_postsremove_query_argrewind_postssetup_postdatasite_urlstatus_headerunzip_filevalidate_filevalidate_file_to_editwpwp_cache_setwp_cache_getwp_cache_reset(不赞成)wp_check_filetypewp_clearcookiewp_diewp_editorwp_footerwp_get_cookie_login(不赞成)wp_get_image_editorwp_get_installed_translationswp_hashwp_handle_sideloadwp_headwp_install_defaultswp_is_mobilewp_mailwp_mkdir_pwp_new_user_notificationwp_password_change_notificationwp_notify_moderatorwp_notify_postauthorwp_parse_argswp_redirectwp_reset_postdatawp_reset_querywp_saltwp_set_auth_cookiewp_safe_redirectwp_upload_bitswp_upload_dirwp_list_pluckwp_text_diffpost_submit_meta_boxpings_openis_page_templateis_authorlike_escape多站点管理员confirm_delete_usersis_user_member_of_blogwp_dashboard_quotaadmin_notice_feed(不赞成)avoid_blog_page_permalink_collision check_import_new_userscheck_upload_sizechoose_primary_blogdisplay_space_usagefix_import_form_sizeformat_code_langget_site_allowed_themesgrant_super_adminms_deprecated_blogs_filemu_dropdown_languagesnew_user_email_admin_noticeredirect_user_to_blogrefresh_user_detailsrevoke_super_adminsecret_salt_warningsend_confirmation_on_profile_email show_post_thumbnail_warning(不赞成)site_admin_noticesync_category_tag_slugsupdate_option_new_admin_email update_user_statusupload_is_user_over_quotaupload_space_settingwpmu_delete_blogwpmu_delete_userwpmu_get_blog_allowedthemes_admin_notice_multisite_activate_plugins_page 其他⽅法add_blog_optiondelete_blog_optionget_blogaddress_by_domainget_blogaddress_by_idget_blogaddress_by_nameget_blog_detailsget_blog_optionget_blog_statusget_id_from_blognameget_last_updatedis_archivedrefresh_blog_detailsrestore_current_blogswitch_to_blogupdate_archivedupdate_blog_detailsupdate_blog_optionupdate_blog_statuswpmu_update_blogs_datems_cookie_constantsms_file_constantsms_subdomain_constantsms_upload_constantsadd_existing_user_to_blogadd_new_user_to_blogadd_user_to_blogcheck_upload_mimescreate_empty_blogdomain_existsfilter_SSLfix_phpmailer_messageidforce_ssl_contentget_active_blog_for_userget_admin_users_for_domainget_blogs_of_userget_blog_countget_blog_id_from_urlget_blog_permalinkget_blog_postget_current_siteget_dashboard_blogget_dirsizeget_most_recent_post_of_userget_sitestatsget_space_allowedget_space_usedget_upload_space_availableget_user_countget_user_id_from_string(不赞成)global_termsinsert_bloginstall_bloginstall_blog_defaultsis_blog_user(不赞成)is_email_address_unsafeis_upload_space_availableis_user_option_localis_user_spammymaybe_add_existing_user_to_blogmaybe_redirect_404newblog_notify_siteadminnewuser_notify_siteadminrecurse_dirsizeredirect_this_siteremove_user_from_blogsignup_nonce_checksignup_nonce_fieldsupdate_blog_publicupdate_posts_countupload_is_file_too_bigupload_is_user_over_quota upload_size_limit_filterusers_can_register_signup_filter welcome_user_msg_filterwp_get_siteswpmu_activate_signupwpmu_create_blogwpmu_create_userwpmu_log_new_registrations wpmu_signup_blogwpmu_signup_blog_notification wpmu_signup_userwpmu_signup_user_notification wpmu_validate_blog_signup wpmu_validate_user_signup wpmu_welcome_notification wpmu_welcome_user_notification get_current_site_name(不赞成)is_subdomain_installms_not_installedms_site_checkwpmu_current_site(不赞成)。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
完整的WordPress函数大全
在修改和制作Wordpress主题时经常为不知道内置函数而苦恼,而wordpress官方的文档看起来又不是那么方便。
所搜集并且整理了一下放这,以备后用。
判断页面函数
is_home() : 是否为主页
is_single() : 是否为内容页(P ost)
is_page() : 是否为内容页(Page)
is_category() : 是否为Category/Archive页
is_tag() : 是否为Tag存档页
is_date() : 是否为指定日期存档页
is_year() : 是否为指定年份存档页
is_month() : 是否为指定月份存档页
is_day() : 是否为指定日存档页
is_time() : 是否为指定时间存档页
is_archive() : 是否为存档页
is_search() : 是否为搜索结果页
is_404() : 是否为“HTTP 404: Not Found”错误页
is_paged() : 主页/Category/Archive页是否以多页显示
Header部分常用到的PHP函数
<?php bloginfo(‟name‟); ?> : 博客名称(Title)
<?php bloginfo(‟stylesheet_url‟); ?> : CSS文件路径<?php bloginfo(‟pingback_url‟); ?> : PingBack Url <?php bloginfo(‟template_url‟); ?> : 模板文件路径<?php bloginfo(‟version‟); ?> : WordPress版本
<?php bloginfo(‟atom_url‟); ?> : Atom Url
<?php bloginfo(‟rss2_url‟); ?> : RSS 2.o Url
<?php bloginfo(‟url‟); ?> : 博客Url
<?php bloginfo(‟html_type‟); ?> : 博客网页Html类型<?php bloginfo(‟charset‟); ?> : 博客网页编码
<?php bloginfo(‟description‟); ?> : 博客描述
<?php wp_title(); ?> : 特定内容页(Post/Page)的标题
模板常用的PHP函数及命令
<?php get_header(); ?> : 调用Header模板
<?php get_sidebar(); ?> : 调用Sidebar模板
<?php get_footer(); ?> : 调用Footer模板
<?php the_content(); ?> : 显示内容(Post/Page)
<?php if(have_posts()) : ?> : 检查是否存在Post/Page
<?php while(have_posts()) : the_post(); ?> : 如果存在P ost/Page则予以显示<?php endwhile; ?> : While 结束
<?php endif; ?> : If 结束
<?php the_time(‟字符串‟) ?> : 显示时间,时间格式由“字符串”参数决定,具体参考PHP手册
<?php comments_popup_link(); ?> : 正文中的留言链接。
如果使用comments_popup_script() ,则留言会在新窗口中打开,反之,则在当前窗口打开<?php the_title(); ?> : 内容页(Post/Page)标题
<?php the_permalink() ?> : 内容页(P ost/Page) Url
<?php the_category(‟, …) ?> : 特定内容页(P ost/Page)所属Category <?php the_author(); ?> : 作者
<?php the_ID(); ?> : 特定内容页(Post/Page) ID
<?php edit_post_link(); ?> : 如果用户已登录并具有权限,显示编辑链接<?php get_links_list(); ?> : 显示Blogroll中的链接
<?php comments_template(); ?> : 调用留言/回复模板
<?php wp_list_pages(); ?> : 显示Page列表
<?php wp_list_categories(); ?> : 显示Categories列表
<?php next_post_link(‟ %link …); ?> : 下一篇文章链接
<?php previous_post_link(‟%link‟); ?> : 上一篇文章链接
<?php get_calendar(); ?> : 日历
<?php wp_get_archives() ?> : 显示内容存档
<?php posts_nav_link(); ?> : 导航,显示上一篇/下一篇文章链接
<?php include(TEMPLATEP ATH . …/文件名‟); ?> : 嵌入其他文件,可为定制的模板或其他类型文件
其他函数
<?php _e(‟Message‟); ?> : 输出相应信息
<?php wp_register(); ?> : 显示注册链接
<?php wp_loginout(); ?> : 显示登录/注销链接
<!–next page–> : 将当前内容分页
<!–more–> : 将当前内容截断,以不在主页/目录页显示全部内容
<?php timer_stop(1); ?> : 网页加载时间(秒)
<?php echo get_num_queries(); ?> : 网页加载查询量。