Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numeric Value after uploading image. #43

Open
iamsalmanafzal opened this issue Apr 12, 2013 · 8 comments
Open

Numeric Value after uploading image. #43

iamsalmanafzal opened this issue Apr 12, 2013 · 8 comments

Comments

@iamsalmanafzal
Copy link

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
Copy link
Owner

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 [email protected]:

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//issues/43
.

@iamsalmanafzal
Copy link
Author

Thanks for you reply.

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

@tammyhart
Copy link
Owner

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
[email protected]:

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//issues/43#issuecomment-16300356
.

@iamsalmanafzal
Copy link
Author

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
Copy link
Owner

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 [email protected]:

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//issues/43#issuecomment-16310162
.

@iamsalmanafzal
Copy link
Author

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

@tammyhart
Copy link
Owner

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 [email protected]:

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//issues/43#issuecomment-16310569
.

@iamsalmanafzal
Copy link
Author

By the way thanks for helping me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants