<p style="text-align: center;">[slider_pro id="1"]</p>
<h1 style="text-align: center;"></h1>
<h1 style="padding-left: -30px; text-align: left;">Featured Posts.</h1>
<h1 style="padding-left: 30px; text-align: center;"></h1>
<p style="padding-left: 30px; text-align: center;">[dropshadowbox align="center" effect="curled" width="97%" border_width="1" border_color="#DDD" inside_shadow="false" ] <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke.jpg"> <img class="alignnone wp-image-280" title="lucky-luke" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke-150x150.jpg" alt="" width="135" height="135" /> </a> <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke.jpg"> <img title="lucky-luke" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke-150x150.jpg" alt="" width="135" height="135" /> </a> <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke.jpg"> <img title="lucky-luke" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke-150x150.jpg" alt="" width="135" height="135" /> </a> <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke.jpg"> <img title="lucky-luke" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke-150x150.jpg" alt="" width="135" height="135" /> </a> <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke.jpg"> <img title="lucky-luke" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/lucky-luke-150x150.jpg" alt="" width="135" height="135" /> </a> [/dropshadowbox]</p>
[wpcol_1third id="" class="" style=""] <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/wordpress-250x250.png"> <img class="alignnone size-full wp-image-300" title="wordpress-250x250" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/wordpress-250x250.png" alt="" width="250" height="250" /> </a> [/wpcol_1third] [wpcol_1third id="" class="" style=""] <a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/wordpress-250x250.png"> <img title="wordpress-250x250" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/wordpress-250x250.png" alt="" width="250" height="250" /> </a> [/wpcol_1third] [wpcol_1third_end id="" class="" style=""]
<div class="art-box"><a href="http://ariadneswonderland.gr/wp-content/uploads/2012/07/wordpress-250x250.png"> <img title="wordpress-250x250" src="http://ariadneswonderland.gr/wp-content/uploads/2012/07/wordpress-250x250.png" alt="" width="250" height="250" /> </a></div>
[/wpcol_1third_end]
The contents of the Homepage’s HTML if it helps.
Max
(@clementsm)
Getting the 5 latest posts is just a custom loop for the one cat. Read The Loop.
displaying the featured images you need to use WordPress Post Thumnails. The template tag you are looking at is the_post_thumbnail() and Justin Tadlock wrote a pretty comprehensive post on how to use post thumnails in your theme here:
http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature
Had a look at your link and thank you for the time. With help from walter at webdesigndepot i’ve now got:
Still no love tho as i can’t figure out how to implement the php into the post, phpexec and similar plugins don’t seem to work for this, tho simple things like echo’test’; work fine.
// fetching latest posts from specific category
$categoryId = 7;
$args = array('category' => categoryId , 'post_status' => 'publish', 'numberposts' => 5);
$posts = get_posts( $args );
foreach($posts as $post){
$feat_image_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
$post_url = get_permalink($post->ID);
}
Thanks for the help
After some struggling, debugging like mad i managed to get a working code:
$categoryId = 7;
$args = array('category' => $categoryId , 'post_status' => 'publish', 'numberposts' => 5);
$posters = get_posts( $args );
if ( $posters ) {
foreach ($posters as $post) {
$imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full");
?>
<a href="<?php echo get_permalink($post->ID); ?>" title=""><img src="<?php echo $imgsrc[0]; ?>" class="thumbnail" width="130" height="130" alt='' /></a>
<?php }
}
I’ve made it into a shortcode [featuredposts category=7] and calling it lets me add the featured images of the latest 5 posts for a category of my choosing!
Could a moderator please remove the link to the website on the first post.
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
It is not the general policy to edit or delete forum posts unless they are spam or outright abuse.
http://codex.ww.wp.xz.cn/Forum_Welcome#Deleting_.2F_Editing_Posts
As a matter of policy editing posts like that is not done unless it’s an extreme case. That link has been there for 5 months, your case is not extreme.