WordPress Tricks

Create Custom Post type and Category (taxonomy) for your Yoga, Teaching, travel, portfolio ,booking or gym workout based site

Just paste the following Code in your theme’s function.php

In the following Code, I have created Instruction post type with Weeks taxonomy (category) for one of my client. He requested me to show his workout plan based on Week and Day basis. So Just change the Name of Post type and taxonomy and save it.

function instruction_post_type_register(){

register_post_type('instructions',array(

'label'=> 'Instructions',
'public' =>true
));
register_taxonomy('weeks','instructions',array(
'labels'=> array(
    'name'=>'Weeks',
    'add_new_item'=>'Add New Week',
    'parent_item'=> 'Parent Week'
    ),
'hierarchical'=>true

));
}
add_action('init','instruction_post_type_register');

Feel free to do comments if you need any sort of helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s