日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

add php support,wordpress函数add_post_type_support()用法示例

發(fā)布時間:2024/7/19 php 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 add php support,wordpress函数add_post_type_support()用法示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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’, ‘a(chǎn)uthor’, ‘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.

參數(shù)

$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.

相關(guān)函數(shù)

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' ) );

總結(jié)

以上是生活随笔為你收集整理的add php support,wordpress函数add_post_type_support()用法示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。