• Resolved iversoncru

    (@iversoncru)


    My problem is that the posts Images are not shown. It is supposed to be simple T.T but i dont get it.

    This is my code inside single.php

    <div id="single_post">
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    		<h2><?php the_title(); ?></h2>
    		<h3><?php the_time('F jS, Y') ?></h3>
    		<?php the_post_thumbnail('full');?>
    		<p><?php the_content(); ?></p>
    	<?php endwhile; ?>
    	<nav>
    		<?php previous_post_link('%link', '< Previous ' , in_same_cat, 'excluded_categories'); ?>
    		<?php next_post_link('%link', ' Next > ', in_same_cat, 'excluded_categories'); ?>
    	</nav>
      </div>
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter iversoncru

    (@iversoncru)

    the images were attached to the posts from the Media Library. This means:
    I created a post and published it.
    Then i went to the Media Library and Add a new image.
    From the Media Library i clicked “attach” to attach the image to the post.

    I dont know whats happening, i was supposed to be easy o.O

    Thread Starter iversoncru

    (@iversoncru)

    i have also tried this code

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<?php echo $post_id = get_the_ID();?>
    	<h2><?php the_title(); ?></h2>
    	<h3><?php the_time('F jS, Y') ?></h3>
    	<?php echo wp_get_attachment_image($post_id, 'full');?>
    	<p><?php the_content(); ?></p>
    <?php endwhile; ?>
    <nav>
    	<?php previous_post_link('%link', '< Previous ' , in_same_cat, 'excluded_categories'); ?>
    	<?php next_post_link('%link', ' Next > ', in_same_cat, 'excluded_categories'); ?>
    </nav>

    Based on the first piece of code, sounds like you just need to do one more thing, set the image as a featured image. Edit the post and along the right hand side, underneath the categories and tag widgets you should see an area to set a featured image.

    If the featured image widget is not available it may not be registered in your functions file. To do that you need to add the following to your functions.php file:

    add_theme_support( 'post-thumbnails' );

    For more information about the post thumbnail see this codex entry

    Thread Starter iversoncru

    (@iversoncru)

    Thanks a lot CarletonU for your answer and your time.

    For the first price of code…

    I had already added the line:
    add_theme_support( ‘post-thumbnails’ );

    But i kept attaching the image from the Media Library. Now i do as you said, and it is working!

    Thanksssssssssssssss a looooot

    Awesome, glad I could help! Don’t forget to mark this topic as resolved

    Thread Starter iversoncru

    (@iversoncru)

    Sure!! thanks again

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘No image showing in single post’ is closed to new replies.