gpt4 book ai didi

Wordpress 自定义帖子类型 + (YARPP)

转载 作者:行者123 更新时间:2023-12-01 11:41:17 28 4
gpt4 key购买 nike

我希望将 (YARPP) 添加到我的自定义帖子类型页面。

我希望将其添加到的自定义帖子类型非常复杂,我正在寻找放置 YARPP 提供的代码的位置。

这是我找到的将代码放入自定义帖子类型的支持:

http://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-making-yarpp-caching-feature-work-for-custom-post-types

这是我的代码:

function property_listing() {
$args = array(
'description' => 'Property Post Type',
'show_ui' => true,
'menu_position' => 4,
'exclude_from_search' => true,
'labels' => array(
'name'=> 'Property Listings',
'singular_name' => 'Property Listings',
'add_new' => 'Add New Property',
'add_new_item' => 'Add New Property',
'edit' => 'Edit Properties',
'edit_item' => 'Edit Property',
'new-item' => 'New Property',
'view' => 'View Property',
'view_item' => 'View Property',
'search_items' => 'Search Properties',
'not_found' => 'No Properties Found',
'not_found_in_trash' => 'No Properties Found in Trash',
'parent' => 'Parent Property'
),
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'query_var' => true,
'supports' => array('title', 'editor', 'thumbnail', 'author', 'comments')
);
register_post_type( 'property' , $args );
flush_rewrite_rules();

有什么想法吗?

最佳答案

是的。在数组的末尾很容易看这里:

我添加了:'yarpp_support' => true

  function property_listing() {

$args = array(
'description' => 'Property Post Type',
'show_ui' => true,
'menu_position' => 4,
'exclude_from_search' => true,
'labels' => array(
'name'=> 'Property Listings',
'singular_name' => 'Property Listings',
'add_new' => 'Add New Property',
'add_new_item' => 'Add New Property',
'edit' => 'Edit Properties',
'edit_item' => 'Edit Property',
'new-item' => 'New Property',
'view' => 'View Property',
'view_item' => 'View Property',
'search_items' => 'Search Properties',
'not_found' => 'No Properties Found',
'not_found_in_trash' => 'No Properties Found in Trash',
'parent' => 'Parent Property'
),
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'query_var' => true,
'supports' => array('title', 'editor', 'thumbnail', 'author', 'comments'),
'yarpp_support' => true
);

register_post_type( 'property' , $args );
flush_rewrite_rules();
}

关于Wordpress 自定义帖子类型 + (YARPP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20497192/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com