Bài đăng

Hiển thị các bài đăng có nhãn WordPress

Manually Creating Custom Taxonomies

Manually Creating Custom Taxonomies ( tao the loai tuy chinh) Add the following code in your theme’s  functions.php  file or in a  site-specific plugin  (recommended)  to create a hierarchical custom taxonomy like categories: //hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_topics_hierarchical_taxonomy', 0 ); //create a custom taxonomy name it topics for your posts function create_topics_hierarchical_taxonomy() { // Add new taxonomy, make it hierarchical like categories //first do the translations part for GUI $labels = array( 'name' => _x( 'Topics', 'taxonomy general name' ), 'singular_name' => _x( 'Topic', 'taxonomy singular name' ), 'search_items' => __( 'Search Topics' ), 'all_items' => __( 'All Topics' ), 'parent_item' => __( 'Parent Topic' ), 'parent_item_colon' =...

Tao Custom Fields (meta-box) ko can plugin

Hình ảnh
Step 1. Define meta box with all needed fields Open the  functions.php  file, and put the following code into it: $prefix = 'dbt_' ; $meta_box = array ( 'id' => 'my-meta-box' , 'title' => 'Custom meta box ' , 'page' => 'post' , 'context' => 'normal' , 'priority' => 'high' , 'fields' => array ( array ( 'name' => 'Text box' , 'desc' => 'Enter something here' , 'id' => $prefix . 'text' , 'type' => 'text' , 'std' => 'Default value 1' ), array ( 'name' => 'Textarea' , 'desc' => 'Enter big text here' , 'id' => $prefix . 'textarea' , ...