Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //post_quary in shortcode
- function department_shortcod($atts){
- extract( shortcode_atts( array(
- 'category' => '',
- ), $atts, 'department' ) );
- $q = new WP_Query(
- array('posts_per_page' => '6','post_type' => 'department',/* Here use post-type*/
- 'department_cat' => $category,)
- );
- $list = 'Here use container start div of your post';/* Here use befour div of your post */
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $list .= 'Here use your code for post';/* Here use your code for post */
- endwhile;
- $list.= 'Here use container end div of your post
- ';
- wp_reset_query();
- return $list;
- }
- add_shortcode('deparment', 'department_shortcod');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement