96SEO 2025-11-12 10:05 0
WordPress作为Zui受欢迎的博客平台之一,其强大的自定义功Neng使其成为构建各种类型网站的理想选择。在这篇文章中,我们将探讨如何轻松创建自定义类型和分类,以提升网站内容丰富度,我始终觉得...。
先说说我们需要定义一个自定义类型。
深得我心。 php function collect_register { $link_labels = array( 'name' => '收藏夹', 'singular_name' => '收藏夹', 'add_new' => '新建收藏网站', 'add_new_item' => '新建一个收藏网站', 'edit_item' => '编辑收藏网站', 'new_item' => '新收藏网站', 'all_items' => '所有收藏夹', 'view_item' => '查kan收藏夹', 'search_items' => '搜索收藏夹', 'not_found' => '没有找到相关网站', 'not_found_in_trash' => '回收站里面没有相关网站', 'parent_item_colon' => '', 'menu_name' => '收藏夹' ); $args = array( 'labels' => $link_labels, 'description' => '', 'public' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-tag', //图标 'supports' => array, 'has_archive' => true ); register_post_type; } add_action;
站在你的角度想... 将上述代码添加到你的WordPress主题的 functions.php 文件中。然后访问WordPress后台的“文章”菜单,你将kan到一个名为“收藏夹”的新类型。
php
function collect_class {
$labels = array(
'name' => '收藏夹分类',
'singular_name' => '收藏夹分类',
'search_items' => __,
'all_items' => __,
'parent_item' => __,
'parent_item_colon' => __,
'edit_item' => __,
'update_item' => __,
'add_new_item' => __,
'new_item_name' => __,
'menu_name' => __,
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
);
register_taxonomy;
}
add_action;
太刺激了。 通过以上步骤, 你Ke以在WordPress中轻松创建自定义类型和分类,以提升网站内容丰富度。希望这篇文章对你有所帮助!
Demand feedback