add php support,wordpress函数add_post_type_support()用法示例
add_post_type_support( string $post_type, string|array $feature )
Register support of certain features for a post type.
描述
All core features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Features include: ‘title’, ‘editor’, ‘comments’, ‘revisions’, ‘trackbacks’, ‘author’, ‘excerpt’, ‘page-attributes’, ‘thumbnail’, ‘custom-fields’, and ‘post-formats’.
Additionally, the ‘revisions’ feature dictates whether the post type will store revisions, and the ‘comments’ feature dictates whether the comments count will show on the edit screen.
参数
$post_type
(string)
(Required)
The post type for which to add the feature.
$feature
(string|array)
(Required)
The feature being added, accepts an array of feature strings or a single string.
源代码
File: wp-includes/post.php
function add_post_type_support( $post_type, $feature ) {
global $_wp_post_type_features;
$features = (array) $feature;
foreach ($features as $feature) {
if ( func_num_args() == 2 )
$_wp_post_type_features[$post_type][$feature] = true;
else
$_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
}
}
更新日志
Version
描述
3.0.0
Introduced.
相关函数
Used By
wp-includes/class-wp-post-type.php:
WP_Post_Type::add_supports()
wp-includes/post.php:
create_initial_post_types()
User Contributed Notes
Skip to note content
You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
Contributed by Codex
This example adds support for excerpts in pages (assuming it is *not* showing under “Screen Options”):
add_action('init', 'wpdocs_custom_init');
/**
* Add excerpt support to pages
*/
function wpdocs_custom_init() {
add_post_type_support( 'page', 'excerpt' );
}
?>
Unfortunately,
add_post_type_support('page', 'thumbnail');
won’t add featured images to pages. For that you need to [add theme support for post-thumbnails
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
add php support,wordpress函数add_post_type_support()用法示例相关推荐
- php中mimes函数,wordpress函数check_upload_mimes()用法示例
check_upload_mimes( array $mimes ) Check an array of MIME types against a whitelist. 描述 WordPress sh ...
- php geteditor,wordpress函数get_editor_stylesheets()用法示例
get_editor_stylesheets() Retrieve any registered editor stylesheets 描述 返回值 (array) If registered, a ...
- php getfooter,wordpress函数get_footer()用法示例
get_footer( string $name = null ) Load footer template. 描述 Includes the footer template for a theme ...
- PHP Calendar 函数,wordpress函数get_calendar()用法示例
get_calendar( bool $initial = true, bool $echo = true ) Display calendar with days that have posts a ...
- escilpe mysql,wordpress函数esc_sql()用法示例
esc_sql( string|array $data ) Escapes data for use in a MySQL query. 描述 Usually you should prepare q ...
- php函数clean(),wordpress函数clean_url()用法示例
Warning: This function has been deprecated. Use esc_url() instead. clean_url( string $url, array $pr ...
- ?php get_sidebar(); ?,wordpress函数get_sidebar()用法示例
get_sidebar( string $name = null ) Load sidebar template. 描述 Includes the sidebar template for a the ...
- html class函数,wordpress函数sanitize_html_class()用法示例
sanitize_html_class( string $class, string $fallback = '' ) Sanitizes an HTML classname to ensure it ...
- php theexcerpt,wordpress的excerpt()函数的用法示例
本篇文章给大家带来的内容是关于wordpress的excerpt()函数的用法示例,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 问题:在wordpres中的single页面,本身引 ...
最新文章
- 2021年UI设计培训机构哪个好
- 关于双机热备,你该知道那些问题?
- 浏览器显示XML文档
- 光流 | OpenCV3实现LK Optical Flow(代码类)
- let finger cross
- VC C/C++ 4种方法获取文件大小 Windows API
- Android监听事件
- 在 .NET Core 中使用 ViewConfig 调试配置
- C#DateTime.ToString格式化时间字符串
- Keras-Sequential模型(1)
- stupid soso spider
- Java 进阶基础知识
- snap7 python连接_python snap7 windows-找不到snap7库
- arp计算机病毒解决办法,“ARP病毒的解决方案”的解决方案
- WinDriver简介(或介绍)
- [日志]中国十大名花
- 冷色系清新调、日系清新调 、电影色调复古风、欧美风复古,用曲线就可以调了!!!...
- 小学生计算机教室注意事项,小学生安全注意事项
- 智能硬件产品经理需要具备的知识
- 高新技术企业申请流程如何