Show Images in post

This topic contains 4 reply and 3 voices, and was last updated by Tareq Hasan 10 years, 1 month ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
March 21, 2014 at 5:11 pm 17037
Tareq Hasan Hello, I am trying to show the images in post content. I have already unchecked the "Show custom fields on post content area" in the General settings. Here following is what I want (seen from the back-end dashboard). Thank you in advance for your help.
March 21, 2014 at 5:41 pm 17042
Mahi Mahi

If you unchecked meta fields to show then try with this tutorial here: http://docs.wedevs.com/showing-meta-fields-in-frontend/#showing-fields-in-the-theme

March 21, 2014 at 6:03 pm 17043
onafets onafets

I am not sure I understand.

1-this is into my single-posttype.php

<?php echo get_post_meta( $post->ID, ‘images’, true ); ?>

2-this is into my function.php

$images = get_post_meta( $post->ID, ‘mey_key_name’ );

if ( $images ) {
foreach ( $images as $attachment_id ) {
$thumb = wp_get_attachment_image( $attachment_id, ‘thumbnail’ );
$full_size = wp_get_attachment_url( $attachment_id );

printf( ‘%s‘, $full_size, $thumb );
}
}

What I got is a number that appears at the bottom of the post

March 22, 2014 at 4:46 am 17068
onafets onafets

Or there is a way to reset options to default?

March 22, 2014 at 8:07 pm 17083
Tareq Hasan Tareq Hasan

You are doing it wrong. Paste the #2 in your single-posttype.php. You don’t need that in functions.php and also #1 is not needed.

Viewing 4 Posts - 1 through 4 (of 4 total)