Hello there,
First off I want to introduce myself.
My name is Alex, I am 23 and I have started learning wordpress a couple of months ago.
I wanted to ask you a question about shortcodes. I have the following code, that I want to transform into a wordpress shortcode with 3 variables: title, number_of_posts and category. I have tried a lot of different ways, but simply it doesn't work. Here is the code I have:
<h3>You may also like...</h3>
<div class="list_carousel responsive">
<ul id="foo2">
<?php
$args = array( 'numberposts' => '5' );
$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>
Thank you all in advance!
Regards,
Alex :)