Monday, 19 October 2015

How to add custom taxonomy


function people_init() {
    // create a new taxonomy
    register_taxonomy(
        'people',
        'post',
        array(
            'label' => __( 'People' ),
            'rewrite' => array( 'slug' => 'person' ),
            'query_var' => true, 'rewrite' => true)       
    );
}
add_action( 'init', 'people_init' );


Extra
<?php query_posts(array('people' => 'Ramesh Yadav', 'showposts' => 10)); ?>


No comments:

Post a Comment