wordpress - How to make custom posts that have custom fields in a WP theme? -


is there way create custom post (e.g. movies) custom fields (e.g. title, director, 0 or more actors, etc.) in wp , make part of theme? i'm guessing needs added in functions.php, i'm not sure how define custom post type , assign custom fields.

if hard part of theme, i'm happy create admin section. suggestions?

i using more fields plugin add custom fields posts (default post type or custom post type).

to create custom post type (and custom taxonomy of course), adding in functions.php code works ok , looks this:

        function post_type_aya_bi_aya() {             $labels = array(                 'name'               => _x( 'التفاسير', 'post type general name' ),                 'singular_name'      => _x( '', 'post type singular name' ),                 'add_new'            => _x( 'أضف تفسير جديد', 'book' ),                 'add_new_item'       => __( 'أضف تفسير جديد' ),                 'edit_item'          => __( 'تحرير التفسير' ),                 'new_item'           => __( 'تفسير جديد' ),                 'all_items'          => __( 'كافة التفاسير' ),                 'view_item'          => __( 'مشاهدة التفسير' ),                 'search_items'       => __( 'بحث في التفاسير' ),                 'not_found'          => __( 'لا يوجد أي تفسير' ),                 'not_found_in_trash' => __( 'لا يوجد أي تفسير في سلة المهملات' ),                  'parent_item_colon'  => '',                 'menu_name'          => 'التفاسير'             );             $args = array(                 'labels'        => $labels,                 'description'   => 'يحنوي على معطيات "آية بآية و التفاسير المرفوعة"',                 'public'        => true,                 'menu_position' => 5,                 'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),                 'has_archive'   => true,                 'rewrite'       => array('slug' => 'aya-bi-aya'),             );             register_post_type( 'aya-bi-aya', $args );           }   add_action( 'init', 'post_type_aya_bi_aya' );  function taxonomy_aya_bi_aya() {         $labels = array(             'name'              => _x( 'السور', 'taxonomy general name' ),             'singular_name'     => _x( 'السورة', 'taxonomy singular name' ),             'search_items'      => __( 'بحث في السور' ),             'all_items'         => __( 'كافة السور' ),             'parent_item'       => __( '' ),             'parent_item_colon' => __( '' ),             'edit_item'         => __( 'تحرير السورة' ),              'update_item'       => __( 'تحديث السورة' ),             'add_new_item'      => __( 'أضف سورة' ),             'new_item_name'     => __( 'سورة جديدة' ),             'menu_name'         => __( 'السور' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'public' => true,              'show_ui' => true,                 'query_var' => 'sowar',          );         register_taxonomy( 'sowar', 'aya-bi-aya', $args );     }  add_action( 'init', 'taxonomy_aya_bi_aya', 0 ); 

i here explain more. luck.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -