Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function kod(){
- $args = array(
- 'category' => 82, // ID danej kategorii
- 'posts_per_page' => -1, // wszystkie wpisy
- 'post_status' => 'publish',
- );
- $posts = get_posts( $args );
- $output = '';
- foreach ( $posts as $post ) :
- setup_postdata( $post );
- $output .= '<p>';
- $output .= '<a href="' . get_the_permalink( $post ). '">' . get_the_title( $post ) . '</a><br/>';
- $output .= get_the_excerpt( $post );
- $output .= '</p>';
- endforeach;
- wp_reset_postdata();
- return $output;
- }
- add_shortcode( 'kod', 'kod' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement