Resize post image to thumbnail size
# October 11, 2009 at 12:34 pm
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:
It lets you upload, and crop images to your pre-determined sizes with a beautiful wysiwyg editor. I’m in love.
You must be logged in to reply to this topic.