TODO: To change the header's content go to Dr.Explain menu Options : Project Settings : HTML (CHM) Export : Setup HTML Template and Layout
×
Menu
Index

Cấu hình

Cài đặt:
Settings > YARPP
Yarpp hỗ trợ mặc định với kiểu dữ liệu bài viết, trong phần cài đặt này bạn tùy chỉnh các options để tìm ra nội dung liên quan với các điều kiện dàng buộc chỉ định như:
 
Hỗ trợ custom post type.
Trường hợp bạn sử dụng custom post type, bạn cần khai báo với YARPP để hỗ trợ. Chúng ta sẽ sửa lại tham số cài đặt pos type bằng cách thêm thuộc tính yarpp_support  vào post type bạn sẽ kích hoạt. Chép đoạn code vào functions.php và sửa lại tên post type của bạn:
add_action( 'registered_post_type', 'hoangweb_label_rename', 10, 2 );
/**
* Modify registered post type menu label
*
* @param string $post_type Registered post type name.
* @param array $args Array of post type parameters.
*/
function hoangweb_label_rename( $post_type, $args ) {
    if ( 'mynews' === $post_type ) {
        global $wp_post_types;
        $args->yarpp_support =true;
        $wp_post_types[ $post_type ] = $args;
    }
}
 
Hoặc khai báo YARPP trong hàm đăng ký post type, tại nơi đăng ký kiểu dữ liệu của bạn:
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', '<a href="http://www.hoangweb.com/tag/editor">editor</a>', 'thumbnail', 'author', 'comments'),
            'yarpp_support' => true
    );
 
       register_post_type( 'property' , $args );
       flush_rewrite_rules();
    }
 
Tiếp đến, vào mục cấu hình YARPP: Check vào mục “Display results from all post types” nếu bạn muốn hiển thị tất cả các post types hỗ trợ taxonomy rồi nhấn save change để xác định custom post type.
 
Chú ý: Bạn phải kích hoạt post types mới thấy các taxonomies của post type đó hiển thị trong mục “Relatedness” options.
Made with help of Dr.Explain

Unregistered version