I'm working on a custom theme with some additional features for my store. To gather all promotions in one place in my store back-end and front-end, I created custom post type, custom taxonomy for it. The code for it is:
/**
*
* Registering custom post type 'promocja'
*
**/
function missplanner_promotion_post_type() {
/**
* UI Labels
**/
$custom_post_labels = array(
'name' => _x( 'Promocje', 'post type general name', 'missplanner-official' ),
'singular_name' => _x( 'Promocje', 'post type singular name', 'missplanner-official' ),
'menu_name' => _x( 'Promocje', 'admin menu', 'missplanner-official' ),
'name_admin_bar' => _x( 'Dodaj promocję', 'add new on admin bar', 'missplanner-official' ),
'add_new' => _x( 'Dodaj promocję', 'promocja', 'missplanner-official' ),
'add_new_item' => __( 'Dodaj promocję', 'missplanner-official' ),
'new_item' => __( 'Nowa promocja', 'missplanner-official' ),
'edit_item' => __( 'Edytuj promocję', 'missplanner-official' ),
'view_item' => __( 'Zobacz promocję', 'missplanner-official' ),
'all_items' => __( 'Zobacz wszystkie promocje', 'missplanner-official' ),
'search_items' => __( 'Szukaj...', 'missplanner-official' ),
'parent_item_colon' => __( 'Elementy rodzice:', 'missplanner-official' ),
'not_found' => __( 'Nie znaleziono.', 'missplanner-official' ),
'not_found_in_trash' => __( 'Nie znaleziono w koszu.', 'missplanner-official' )
);
/**
* Other options
**/
$custom_post_args = array(
'labels' => $custom_post_labels,
'description' => __( 'Wszystkie promocje Miss Planner.', 'missplanner-official' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'promocja' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' )
);
register_post_type( 'promocja', $custom_post_args);
}
add_action( 'init', 'missplanner_promotion_post_type' );
/**
*
* Custom Taxonomy for post type "Promocja"
*
**/
add_action( 'init', 'missplanner_promotion_taxonomy', 0);
function missplanner_promotion_taxonomy() {
/**
* custom taxonomy labels
**/
$kategorie_promocje_labels = array(
'name' => _x( 'Kategorie Promocji', 'taxonomy general name', 'missplanner-official' ),
'singular_name' => _x( 'Kategoria Promocji', 'taxonomy singular name', 'missplanner-official' ),
'search_items' => __( 'Szukaj kategorii promocji', 'missplanner-official' ),
'all_items' => __( 'Wszystkie kategorie promocji', 'missplanner-official' ),
'parent_item' => __( 'Kategorie Promocji rodzic', 'missplanner-official' ),
'parent_item_colon' => __( 'Kategorie Promocji rodzic:', 'missplanner-official' ),
'edit_item' => __( 'Edytuj kategorię promocji', 'missplanner-official' ),
'update_item' => __( 'Aktualizuj kategorię promocji', 'missplanner-official' ),
'add_new_item' => __( 'Dodaj nową kategorię promocji', 'missplanner-official' ),
'new_item_name' => __( 'Nazwa nowej kategorii promocji', 'missplanner-official' ),
'menu_name' => __( 'Kategorie Promocji', 'missplanner-official' ),
);
/**
* custom taxonomy args
**/
$kategorie_promocje_args = array(
'hierarchical' => true,
'labels' => $kategorie_promocje_labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'promocje' ),
);
/**
* Add taxonomy "Kategorie Promocji"
**/
register_taxonomy( 'kategorie-promocji', array( 'promocja' ), $kategorie_promocje_args );
}
And here is the breadcrumb on single product page (everywhere else it works just fine):
After setting all my custom posts as drafts, it goes back to normal.
Where should I change my code?
<?php endwhile; wp_reset_postdata(); ?>