Selecte and retrieve file path to image using dialog box
I'm ex开发者_如何学Cpanding 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?
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.
精彩评论