<?php
// ==============================
// Register "Pricing" Post Type
// ==============================
add_action('init', 'pricing_post_type');
function pricing_post_type() {
    $labels = array(
        'name'               => _x('Pricing', 'post type general name'),
        'singular_name'      => _x('Pricing', 'post type singular name'),
        'add_new'            => _x('Add New', 'pricing'),
        'add_new_item'       => __('Add New Pricing'),
        'edit_item'          => __('Edit Pricing'),
        'new_item'           => __('New Pricing'),
        'view_item'          => __('View Pricing'),
        'search_items'       => __('Search Pricing'),
        'not_found'          => __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon'  => ''
    );

    $args = array(
        'labels'             => $labels,
        'public'             => true,
        'publicly_queryable' => true, // ✅ allow single pricing pages
        'show_ui'            => true,
        'query_var'          => true,
        'rewrite'            => array('slug' => 'pricing'),
        'capability_type'    => 'post',
        'hierarchical'       => false,
        'menu_position'      => 8,
        'supports'           => array('title', 'editor', 'thumbnail', 'page-attributes'),
        'taxonomies'         => array('post_tag'), // ✅ enable default WP tags
    );

    register_post_type('pricing', $args);
}

// ==============================
// Register "Pricing Categories" Taxonomy
// ==============================
add_action('init', 'pricing_taxonomies', 0);
function pricing_taxonomies() {
    $labels = array(
        'name'              => _x('Categories', 'taxonomy general name'),
        'singular_name'     => _x('Category', 'taxonomy singular name'),
        'search_items'      => __('Search Categories'),
        'all_items'         => __('All Categories'),
        'parent_item'       => __('Parent Category'),
        'parent_item_colon' => __('Parent Category:'),
        'edit_item'         => __('Edit Category'),
        'update_item'       => __('Update Category'),
        'add_new_item'      => __('Add New Category'),
        'new_item_name'     => __('New Category Name'),
        'menu_name'         => __('Categories'),
    );

    $args = array(
        'hierarchical'      => true,
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array('slug' => 'pricing-category'),
    );

    register_taxonomy('pricing_categories', array('pricing'), $args);
}
?>
