tags:

views:

20

answers:

1

I'm expanding Wordpress to function more like a CMS. This includes relating image to a post.

Currently I have a text field where I paste an image path. Now I want to click a button which opens a dialog box, then I navigate to the right folder and select a file to "open" (from server side).

The file path is returned.

How can I go about accomplishing this?

+2  A: 

Have you heard of Post Thumbnails?. It sounds like you're duplicating what they do.

Add add_theme_support( 'post-thumbnails' ); to the functions.php file of your current theme.

If you don't have a file named functions.php in your theme, create one, and put this in it:

<?php
add_theme_support( 'post-thumbnails' );
?>

if that still does not do what you want you might look at Custom Fields.

artlung
+1 for add_theme_support, but as far as i know 'post-thumbnails' is supported in lastest version of wordpress.
Sarfraz
Yes, it's in there in 2.9.2 -- and it's awesome! But the posting interface to add post thumbnails to posts or pages does not appear unless you activate it in `functions.php`. I think it was decided not to show it unless the theme claims to use it. If more themes supported it, I think more people would use it!
artlung
Yes, I just discovered that this morning: http://wpengineer.com/new-feature-in-wordpress-2-9-the_post_image/. But as Artlung says, it's not visible in WP by default. I will see if I can customize this even further. E.g. one cannot see what imaeg is related, and it's also placed in the side bar. Thanks!
Steven