runy 221 ارسال شده در دی 95 گزارش بازنشر ارسال شده در دی 95 (ویرایش شده) سلام کد پست تایپ زیر را در فانشن گذاشتم . //---------------------— function wpp_custom_post_type() { $labels = array( 'name' => __( 'Post Types', 'text_domain' ), 'singular_name' => __( 'Post Type', 'text_domain' ), 'menu_name' => __( 'Post Type', 'text_domain' ), 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), 'all_items' => __( 'All Items', 'text_domain' ), 'view_item' => __( 'View Item', 'text_domain' ), 'add_new_item' => __( 'Add New Item', 'text_domain' ), 'add_new' => __( 'Add New', 'text_domain' ), 'edit_item' => __( 'Edit Item', 'text_domain' ), 'update_item' => __( 'Update Item', 'text_domain' ), 'search_items' => __( 'Search Item', 'text_domain' ), 'not_found' => __( 'Not found', 'text_domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), ); $rewrite = array( 'slug' => 'post_type', 'with_front' => true, 'pages' => true, 'feeds' => true, ); $capabilities = array( 'edit_post' => 'edit_post', 'read_post' => 'read_post', 'delete_post' => 'delete_post', 'edit_posts' => 'edit_posts', 'edit_others_posts' => 'edit_others_posts', 'publish_posts' => 'publish_posts', 'read_private_posts' => 'read_private_posts', ); $args = array( 'label' => __( 'post_type', 'text_domain' ), 'description' => __( 'Post Type Description', 'text_domain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ), 'taxonomies' => array( 'category', 'post_tag' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-welcome-learn-more', 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'query_var' => 'post_type', 'rewrite' => $rewrite, 'capabilities' => $capabilities, ); register_post_type( 'post_type', $args ); } add_action( 'init', 'wpp_custom_post_type', 0 ); //------------ ولی نمیتونه پست ها را نمایش بده . مشکل دومش اینکه حتی تو لیست خودش توی پیشخوان هم نمیتونه نمایش بده . مشکل کجاست ؟؟ ویرایش شده دی 95 توسط runy نقل قول لینک به ارسال
Morteza 34190 ارسال شده در دی 95 گزارش بازنشر ارسال شده در دی 95 این رو تست کنید: function register_simple_post_type() { $args = array( 'public' => true, 'label' => 'پست تایپ من', 'supports' => array( 'title', 'custom-fields' ) ); register_post_type( 'simpletype', $args ); } add_action( 'init', 'register_simple_post_type' ); نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .