Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =====================================================================================================
- // Register Custom Taxonomy
- =====================================================================================================
- <?php
- function pages_taxonomy() {
- register_taxonomy(
- 'pages_cat', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
- 'page', //post type name
- array(
- 'hierarchical' => true,
- 'label' => 'Page Category', //Display name
- 'query_var' => true,
- 'rewrite' => array(
- 'slug' => 'page-category', // This controls the base slug that will display before each term
- 'with_front' => false // Don't display the category base before
- )
- )
- );
- }
- add_action( 'init', 'pages_taxonomy');
- <?
- =====================================================================================================
- // Custom Taxonomy Query
- =====================================================================================================
- <?php
- global $post;
- $args = array( 'posts_per_page' => -1, 'post_type'=> 'staff', 'department_cat' => 'Commerical' );
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- // Your Post Content. Title, detail etc.
- <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement