2013-12-10 3 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'); 

또한 추가 할 수는 배열의 끝에 여기 쉽게 모양입니다 어린이 테마이므로 테마를 업데이트하는 것에 대해 걱정할 필요가 없습니다.

관련 문제