Skip to content Skip to sidebar Skip to footer

Wordpress Display Featured Posts Outside Of Loop

Im new to WP and Im not real sure how to work with the loop. I am trying to display featured posts in the sidebar with this code:

Solution 1:

I don't know how to integrate your thumbnail resizer, but a start is this new query, which I use multiple instances (they won't conflict) in my sidebar to show posts from a particular category. "mycategory" can be a category number and showposts can be a number of posts to show or -1 to show all.

<?php$my_query = new WP_Query('category_name=mycategory&showposts=10'); ?><?phpwhile ($my_query->have_posts()) : $my_query->the_post(); ?><ahref="<?php the_permalink() ?>"title="Permanent Link to: 
<?php the_title_attribute(); ?>"><?php the_title(); ?></a><?phpendwhile; ?>

Function Reference/WP Query « WordPress Codex

You could add image info in a custom field and then call that:

<?phpecho get_post_meta($post->ID, "image", $single = true); ?>

Function Reference/get post meta « WordPress Codex

Post a Comment for "Wordpress Display Featured Posts Outside Of Loop"