Meta Box là tính năng tạo một khung nhập liệu thêm vào trong khu vực soạn thảo, được sử dụng để thêm các dữ liệu thêm vào cho meta user và meta post.
Nguồn: https://espace-risque.com/
Xem thêm bài viết: https://espace-risque.com/category/cong-nghe
Meta Box là tính năng tạo một khung nhập liệu thêm vào trong khu vực soạn thảo, được sử dụng để thêm các dữ liệu thêm vào cho meta user và meta post.
Nguồn: https://espace-risque.com/
Xem thêm bài viết: https://espace-risque.com/category/cong-nghe
mình lưu lại nhưng nếu có dấu cách trong value sẽ bị lỗi ạ, vd: em lưu "Học PHP", thì nó chỉ lưu được chữ "Học" thôi
Nói nhỏ quá admin ơi, ko nghe được gì . Cám ơn, bài viết rất cụ thể, ngoài ra mọi người có thể tham khảo bài viết này http://bit.ly/2OmKNrD
anh Thạch cho em hỏi xíu ạ!
Em tạo được custom post type nó hiển thị ra menu rồi .khi em add một post trên đó thì nó không vào single hay page nhưng em test thử trên index lại có. Vậy là bị sao ạ. Em không thấy nó link đến single-services luôn ạ.
Mong a trả lời em sớm
code của em :
function create_services_post_type()
{
register_post_type('services', array(
'labels' => array(
'name' => __('Services', 'azsvietnam'),
'singular_name' => __('Service', 'azsvietnam'),
'add_new' => __('Add New', 'azsvietnam'),
'add_new_item' => __('Add New Service', 'azsvietnam'),
'edit' => __('Edit', 'azsvietnam'),
'edit_item' => __('Edit Service', 'azsvietnam'),
'new_item' => __('New service', 'azsvietnam'),
'view' => __('View service', 'azsvietnam'),
'view_item' => __('View Item service', 'azsvietnam'),
'search_items' => __('Search services', 'azsvietnam'),
'not_found' => __('No service found…'),
'not_found_in_trash' => __('No service found in trash', 'azsvietnam')
),
'public' => true,
'show_ui' =>true,
'publicly_queryable' => 'true',
'exclude_from_search' => 'false',
'menu_position' => 20,//vị trí hiển thị:20=sau pages
'menu_icon' => 'dashicons-chart-pie',//THEME_URI.'/images/logo.png' đường dẫn
'hierarchical' => false,//có được phân cấp như category hay không
'query_var' => true,
'supports' => array(
'title', 'editor', 'comments', 'author', 'excerpt', 'thumbnail', 'custom-fields'
),//các meta box trong phần add,…
'rewrite' => array('slug' => 'services', 'with_front' => false),//rewrite lại url khi query
//'taxonomies' => array('tên taxonomy', 'tên post'),
'can_export' => true,//export ra xml
'description' => __('service description here.','azsvietnam')
));
}
add_action('init', 'create_services_post_type');
Anh Thạch cho em hỏi.
Mỗi lần em bị lỗi là nó trắng màn hình visite chỉ hiện mỗi dòng lỗi ra.
Làm sao để giống của anh, vẫn hiện nội dung và hiện lỗi