Added a custom article type, configured with the lablse parameter, and continued to explain the use of other parameters.
Let’s look at description first. This parameter is a short description of the newly created article type. After adding it, the background and foreground are not displayed. I haven’t seen any specific examples of using this description parameter, but I can’t use it. It means that others cannot use it. To output the description information of a certain article type, you must first obtain the article type object:
$obj = get_post_type_object( 'book' ); echo $obj->description;
In this way, the description information of the book article type we created in the previous tutorial can be output (the description variable is not added in the code of the previous tutorial, please add it by yourself).
The above method is one, method two (recommended):
In fact, wp has a global variable $wp_post_types; interested observers can use the var_dump function to output this variable to see, the array variable contains all post types such as wp's default post\page, compared to method XNUMX using the function get_post_type_object, and A variable $obj is created.Method two should be faster and more efficient.So the second method should be the best choice.