Reputation: 45463
If you look at my site, I have an area named Top Winter Projects in the right-side navigation. I would like to automate this part of the site as I currently have to manually paste HTML into that particular section. What I want to be able to to do is have those images (which should link to the corresponding post) change based on date.
I've tried using the featured image plugin, but that doesn't seem to work with my theme for some reason. Is there an alternate route?
I've tried piecing some code together, but i'm a bit clueless when it comes to php. I'm also not sure how i'd get a picture to show up. Here is what I have, where 40, 50, & 60 are three posts. Can echo calls show pictures?
<? php
$args = array('include' => 40, 50, 60 )
echo get_posts($args);
?>
Here is my website: http://www.merrimentdesign.com
Thanks, any help is appreciated.
Upvotes: 0
Views: 86
Reputation: 12836
One way to do it is to create a loop using WP_Query and then you can put whatever content you want in the loop. I typically do this and use categories to control what posts are shown in each area. So for example if you created a category called featured, you could tag every post you want to show in that section with that category. Then you could create a simple loop like :
<?php $the_query = new WP_Query('category_name=featured&showposts=10'); ?>
<?php while ($the_query->have_posts()) : $the_query->the_post();?>
<a href="<?php the_permalink() ?>" rel="bookmark" class="postTitleLink">
<?php the_post_thumbnail(); ?>
</a>
<?php endwhile; ?>
This is assuming you have the thumbnail function enabled in your themes functions.php.
add_theme_support( 'post-thumbnails' );
Upvotes: 1