tammyhart / Reusable-Custom-WordPress-Meta-Boxes

177 stars 97 forks source link

Numeric Value after uploading image. #43

Open iamsalmanafzal opened 11 years ago

iamsalmanafzal commented 11 years ago

Hello Sir, if any one can reply me fast - i will be very thankful.

When i upload image and update post or page. i will get numeric value of image in custom fields. like "35" , "41", "134" but i think it should show URL of Image. insteaded of Numeric value.

metaimage

It would be great if anyone can reply me today.

tammyhart commented 11 years ago

the value is a post id. You can use this id with functions like wp_get_attachment_image, which offers more flexibility than the direct URL.

Tammy Hart

www.tammyhartdesigns.com www.twitter.com/tammyhart

On Fri, Apr 12, 2013 at 4:26 AM, iamsalmanafzal notifications@github.comwrote:

Hello Sir, if any one can reply me fast - i will be very thankful.

When i upload image and update post or page. i will get numeric value of image in custom fields. like "35" , "41", "134" but i think it should show URL of Image. insteaded of Numeric value.

[image: metaimage]https://f.cloud.github.com/assets/3998015/372083/f74c77e2-a352-11e2-88a5-c5f58daceb71.jpg

It would be great if anyone can reply me today.

— Reply to this email directly or view it on GitHubhttps://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/issues/43 .

iamsalmanafzal commented 11 years ago

Thanks for you reply.

Can you please provide me a full code - i am not expert

tammyhart commented 11 years ago

Here is the codex on this function: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image

The $attachment_id would be the post meta value that is stored. So in your case you would use this:

$attachment_id = get_post_meta( $post->ID, 'custom_image', true ); echo wp_get_attachment_image( $attachment_id, 'thumbnail' );

And that would output the thumbnail of the image.

Tammy Hart

www.tammyhartdesigns.com www.twitter.com/tammyhart

On Fri, Apr 12, 2013 at 10:45 AM, iamsalmanafzal notifications@github.comwrote:

Thanks for you reply.

Can you please provide me a full code - i am not expert

— Reply to this email directly or view it on GitHubhttps://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/issues/43#issuecomment-16300356 .

iamsalmanafzal commented 11 years ago

This is working Great Thanks you

But i am having 1 more thing. This meta box is not showing in Page section but it is working great with post section

tammyhart commented 11 years ago

See docs here: https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes#instantiate-the-class-with-all-required-variables

You can put in a string or array of posts styles. So if you want it to work on both posts and pages, you would replace 'post' with array( 'post, 'page' ).

Tammy Hart

www.tammyhartdesigns.com www.twitter.com/tammyhart

On Fri, Apr 12, 2013 at 1:42 PM, iamsalmanafzal notifications@github.comwrote:

This is working Great Thanks you

But i am having 1 more thing. This meta box is not showing in Page section but it is working great with post section

— Reply to this email directly or view it on GitHubhttps://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/issues/43#issuecomment-16310162 .

iamsalmanafzal commented 11 years ago

Can you please help me regarding this point. i am dump and could not understand high coding

tammyhart commented 11 years ago

I've explained it the best I can, especially since I'm no longer supporting this code anymore. Sorry.

Tammy Hart

www.tammyhartdesigns.com www.twitter.com/tammyhart

On Fri, Apr 12, 2013 at 1:49 PM, iamsalmanafzal notifications@github.comwrote:

Can you please help me regarding this point. i am dump and could not understand high coding

— Reply to this email directly or view it on GitHubhttps://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/issues/43#issuecomment-16310569 .

iamsalmanafzal commented 11 years ago

By the way thanks for helping me