Grow your CSS skills. Land your dream job.

Resize post image to thumbnail size

  • # October 11, 2009 at 12:34 pm

    Hello all,

    Chris, thanks for a great site! I am a pretty new in the design/development business and css-tricks has really helped me loads in all sorts of ways.
    So I decided to learn WordPress as my first CMS and so far it’s all been pretty smooth and painless, but since my php skills are pretty rubbish I have now run into some problems and I was hoping you guys might be able to help. I am trying to display the most recent post of my Events category on my home page. So far it’s going well, everything is displayed as intended (date, title and content). This is my code:

    Code:
    < ?php $recent_events = new WP_Query(); ?>
    < ?php $recent_events->query(‘cat=4&showposts=1′); ?>
    < ?php global $more; ?>
    < ?php while($recent_events->have_posts()) : $recent_events->the_post(); ?>

  • < ?php the_date('d/m Y'); ?>

    “>< ?php the_title(); ?>
    < ?php $more = 0; the_content("More..."); ?>

  • < ?php endwhile; ?>

Now: I would like to display images as well, which it does at the moment, but my question is, how do I resize the post images to display as (max-width: 50px / max-height:50px) thumbnails?

One more thing, is there a way of making the title link (<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>) to link to the category page rather than the permalink to the post?

So if someone clicks on the title it brings them to my Events News page, and if they click on the ‘More…’ it takes them to the single post (as it does at the moment).

Thanks in advance!

em

# October 12, 2009 at 2:25 am

I just found this plugin today, and it is freaking fantastic:

http://wordpress.org/extend/plugins/wp-post-thumbnail/

It lets you upload, and crop images to your pre-determined sizes with a beautiful wysiwyg editor. I’m in love.

# October 15, 2009 at 4:44 pm

Wow, this is perfect! What a beautiful plugin. Thanks Ashton.

However I can’t get it to show in my Manage Plugins section. Any ideas what may have gone wrong?
I downloaded the beta version.

Thanks,
em

# October 15, 2009 at 5:56 pm

Hi Emma,

You need to unzip the file then follow the instructions at http://wordpress.org/extend/plugins/wp- … tallation/

Have fun.
Dave

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".