Follow these steps .
Add the following code to your functions.php
add_shortcode( 'list-team', 'list_team_members' );
function list_team_members( $atts ) {
ob_start();
// define attributes and their defaults
extract( shortcode_atts( array (
'type' => 'post',
'posts' => 5,
'category' => '',
), $atts ) );
// define query parameters based on attributes
$options = array(
'post_type' => $type,
'posts_per_page' => $posts,
'category_name' => $category,
);
$query = new WP_Query( $options );
// run the loop based on the query
if ( $query->have_posts() ) { ?>
<ul class="">
<ul class="">
<li id="post-<?php the_ID(); ?>">></li>
</ul>
</ul>
<?php
$myvariable = ob_get_clean();
return $myvariable;
}
}
and then call any department – [list-team category=” “]
You dont need to create specific template files for this…
shortcodes will do for you..
I wrote this in little hurry…
you can get full code at http://code.tutsplus.com/tutorials/create-a-shortcode-to-list-posts-with-multiple-parameters–wp-32199