Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know that it should be quite easy to do but I can't seem to figure it out.

Firstly, I have a category, with some sub-categories. I would like to have a page that displays all the post made in that year, from within those categories using only their featured images.

However, I haven't added featured images for all the posts and would like it to default to set images for each category if it doesn't have a featured image.

In addition, I would also like to have the post name and the publication date as the link title.

Sorry for being so demanding.

I'm almost there. I can display a featured image with the link and attributes I want but I can't seem to get the fallback image working. Here is the code I have. I know it must be a simple elementary mistake. I will need to add more ElseIf statments.

<?php query_posts('cat=81&year=2011'); ?>
                    <?php while (have_posts()) : the_post(); ?>
                        <?php if ( has_post_thumbnail()) ; {
                        <a href="<?php the_permalink(); ?>"><?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?><img src="<?php echo $url; ?>" title="<?php the_title_attribute(); ?> <?php the_time('jS F Y') ?>" height="90" width="180" /></a>;
                        }
                        else if(in_category(91))
                        {
                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?> <?php the_time('jS F Y') ?>" ><img src="/media/admin/hl1-thumbnail.jpg"></a>;

                        <?php endif; ?>
                    <?php endwhile; ?>

Any help would be greatly appreciated.

TIA

share|improve this question
    
Try breaking this up into separate questions. –  Jeremy Jared Jan 29 '12 at 17:03

1 Answer 1

Something like this http://wordpress.org/extend/plugins/image-archives/ ?

share|improve this answer
    
Yes, very similar to that - thanks. I'll see if I can get the code I need from there. –  PlanetPhillip Jan 30 '12 at 9:44
    
I'm almost there. Ic an display a featured image with the link and attributes I want but I can't seem to get the fallback working. –  PlanetPhillip Jan 31 '12 at 10:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.