Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode('carousel_shortcode', 'carousel_shortcode');
- function carousel_shortcode($atts) {
- extract(shortcode_atts(array(
- 'title' => 'You may also like...',
- 'number_of_posts' => '',
- 'category' => ''
- ), $atts));
- return '<h3>'. $title .'</h3><div class="list_carousel responsive"><ul id="foo2">' .
- $args = array( 'numberposts' => $number_of_posts, 'category' => $category ) .
- $recent_posts = wp_get_recent_posts( $args ) .
- foreach( $recent_posts as $recent ){ .
- if ( has_post_thumbnail($recent["ID"])) { .
- echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . get_the_post_thumbnail($recent["ID"], 'large') . '</a> .
- <a href="' . get_permalink($recent["ID"]) . '" class="carousel-post-title" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li>' .
- } .
- } .
- '</ul><div class="clearfix"></div><a id="prev2" class="prev" href="#"><</a><a id="next2" class="next" href="#">></a></div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement