I am currently trying to add a featured post to my wordpress home page which will link to the post in the blog.
I have found the plugin below but it only adds it to the side bar, does anyone know a plugin that does something similiar but can be placed on the home page
http://wordpress.org/extend/plugins/featured-po开发者_如何转开发st-with-thumbnail/
You don't really need a plugin. A quick way to do this would be to create a home.php template file, and then pull in the first post of your "Featured" category into the home page template:
<?php
query_posts(array('category_name' => 'featured', 'posts_per_page' => '1'));
if(have_posts()): the_post();
$do_not_duplicate = $post->ID; // set up the post so you can skip it later
$thumbnail = get_the_post_thumbnail($post->ID, 'medium');?>
<div id="post-<?php the_ID(); ?> <?php post_class(); ?>>
<?php the_content(); // the post content ?>
<?php echo $thumbnail; // the Featured image set with the post ?>
</div>
<?php endwhile; endif; wp_reset_query(); ?>
<?php // set up the query for the rest of your posts
if(have_posts()) : while(have_posts()): the_post();
if($post->ID == $do_not_duplicate) continue; // skip the one that's already showing ?>
<!-- do your layout here -->
<?php endwhile; endif; ?>
精彩评论