2013-12-10 258 views
2

我期待添加(YARPP)到我的自定義帖子類型頁面。WordPress的自定義帖子類型+(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(); 

}

任何想法?

回答

3

是的。在這裏很容易看數組的末尾:

我說:'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(); 
    } 
1

嘗試添加以下代碼到你的主題的functions.php文件:

function wpurp_register_post_type($args) 
{ 
    $args['yarpp_support'] = true; 
    return $args; 
} 

add_filter('wpurp_register_post_type', 'wpurp_register_post_type'); 

您還添加這在一個兒童主題中,所以你不必擔心更新主題。

相關問題