Custom Post Type dan Taxonomy
-
Selamat pagi siang malam mastah
Saya dapet kesulitan nih, single-custom.php saya tidak mau tampil
Cek disiniSebelumnya saya buat custom post type sama taxonomynya
Mohon dicek, ini codenya// Register Custom Taxonomy function portfolio_categories() { $labels = array( 'name' => 'Portfolio Categories', 'singular_name' => 'Portfolio Categories', 'menu_name' => 'Portfolio Categories', 'all_items' => 'All Items', 'parent_item' => 'Parent Item', 'parent_item_colon' => 'Parent Item:', 'new_item_name' => 'New Item Name', 'add_new_item' => 'Add New Item', 'edit_item' => 'Edit Item', 'update_item' => 'Update Item', 'separate_items_with_commas' => 'Separate items with commas', 'search_items' => 'Search Items', 'add_or_remove_items' => 'Add or remove items', 'choose_from_most_used' => 'Choose from the most used items', 'not_found' => 'Not Found', ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'rewrite' => array( 'slug' => 'portfolio' ), ); register_taxonomy( 'portfolio-categories', array( 'portfolio' ), $args ); } // Hook into the 'init' action add_action( 'init', 'portfolio_categories', 0 ); // Register Custom Post Type function portfolio_post_type() { $labels = array( 'name' => 'Portfolio', 'singular_name' => 'Portfolio', 'menu_name' => 'Portfolio', 'parent_item_colon' => 'Parent Item:', 'all_items' => 'All Items', 'view_item' => 'View Item', 'add_new_item' => 'Add New Item', 'add_new' => 'Add New', 'edit_item' => 'Edit Item', 'update_item' => 'Update Item', 'search_items' => 'Search Item', 'not_found' => 'Not found', 'not_found_in_trash' => 'Not found in Trash', ); $args = array( 'label' => 'portfolio', 'description' => 'Portfolio', 'labels' => $labels, 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', ), 'taxonomies' => array( 'portfolio' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', ); register_post_type( 'portfolio', $args ); } add_theme_support( 'post-thumbnails' ); if ( function_exists( 'add_image_size' ) ) { add_image_size( 'thumb-2', 250, 250, array( top, left ) ); } // Hook into the 'init' action add_action( 'init', 'portfolio_post_type', 0 );
Minta solusinya mastah ?
- Topik ‘Custom Post Type dan Taxonomy’ tertutup untuk balasan baru.