How to assign post to category

I have created custom post type and created two post category This Month and Next Month and assigned sample posts to each category. When I preview the category archive ../category/this-month a page said Nothing Found so I assume that the page exist but the post is not display. The question is how can I make any post that is assign to post category show on say /category/this-month?

// Register Custom Post Type
function activity() {

$labels = array(
‘name’ => _x( ‘Activity’, ‘Post Type General Name’, ‘twenty_two’ ),
‘singular_name’ => _x( ‘Activity’, ‘Post Type Singular Name’, ‘twenty_two’ ),
‘menu_name’ => __( ‘Activity’, ‘twenty_two’ ),
‘name_admin_bar’ => __( ‘Activity’, ‘twenty_two’ ),
‘archives’ => __( ‘Item Archives’, ‘twenty_two’ ),
‘attributes’ => __( ‘Item Attributes’, ‘twenty_two’ ),
‘parent_item_colon’ => __( ‘Parent Product:’, ‘twenty_two’ ),
‘all_items’ => __( ‘All Activity’, ‘twenty_two’ ),
‘add_new_item’ => __( ‘Add New Activity’, ‘twenty_two’ ),
‘add_new’ => __( ‘New Activity’, ‘twenty_two’ ),
‘new_item’ => __( ‘New Item’, ‘twenty_two’ ),
‘edit_item’ => __( ‘Edit Activity’, ‘twenty_two’ ),
‘update_item’ => __( ‘Update Activity’, ‘twenty_two’ ),
‘view_item’ => __( ‘View Activity’, ‘twenty_two’ ),
‘view_items’ => __( ‘View Items’, ‘twenty_two’ ),
‘search_items’ => __( ‘Search Activity’, ‘twenty_two’ ),
‘not_found’ => __( ‘No Activity found’, ‘twenty_two’ ),
‘not_found_in_trash’ => __( ‘No products found in Trash’, ‘twenty_two’ ),
‘featured_image’ => __( ‘Featured Image’, ‘twenty_two’ ),
‘set_featured_image’ => __( ‘Set featured image’, ‘twenty_two’ ),
‘remove_featured_image’ => __( ‘Remove featured image’, ‘twenty_two’ ),
‘use_featured_image’ => __( ‘Use as featured image’, ‘twenty_two’ ),
‘insert_into_item’ => __( ‘Insert into item’, ‘twenty_two’ ),
‘uploaded_to_this_item’ => __( ‘Uploaded to this item’, ‘twenty_two’ ),
‘items_list’ => __( ‘Items list’, ‘twenty_two’ ),
‘items_list_navigation’ => __( ‘Items list navigation’, ‘twenty_two’ ),
‘filter_items_list’ => __( ‘Filter items list’, ‘twenty_two’ ),
);
$args = array(
‘label’ => __( ‘Activity’, ‘twenty_two’ ),
‘description’ => __( ‘Display activities post’, ‘twenty_two’ ),
‘labels’ => $labels,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ ),
‘taxonomies’ => array( ‘category’, ‘post_tag’ ),
‘hierarchical’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘show_in_admin_bar’ => true,
‘show_in_nav_menus’ => true,
‘can_export’ => true,
‘has_archive’ => ‘activities’,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘capability_type’ => ‘page’,
);
register_post_type( ‘activity’, $args );

}
add_action( ‘init’, ‘activity’, 0 );

Read more here:: How to assign post to category

Leave a Reply

Your email address will not be published. Required fields are marked *