Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Статьи из категории
- function nlt_getPosts($catID='',$count=5){
- $data = new WP_Query(array(
- 'cat' => (integer)$catID,
- 'showposts' => $count,
- 'post__not_in' => get_option('sticky_posts'),
- ));
- if ( $data->have_posts() ) {
- $output = '<ul>';
- while ($data->have_posts()) {
- $data->the_post();
- $output .= sprintf('<li><a href="%s">%s</a></li>', get_permalink(), get_the_title());
- }
- $output .= '</ul>';
- wp_reset_postdata();
- echo $output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement