WordPress.org

Support

Support » How-To and Troubleshooting » Featured Image not showing

Featured Image not showing

  • Christian Eugster

    @christianeugstergmxnet

    Hi, ich have enabled the featured image feature. I am working with wordpress 3.4.1 and used it as cms (I use only pages). I add a featured image to a page and this image is shown in the page’s editor screen on the left. But when I view the page, the part, where the image is supposed to be, there is only an empty place. Back checking the image on the page’s editor screen, the image is shown. What am I doing wrong? Thank you for any help or suggestion!

    Christian Eugster

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator keesiemeijer

    @keesiemeijer

    Hi, ich have enabled the featured image feature.

    How did you enable it? By adding this to your theme’s functions.php?

    add_theme_support( 'post-thumbnails' );

    Did you put the code to display the featured image in your theme’s page.php:
    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    http://codex.wordpress.org/Post_Thumbnails

    Christian Eugster

    @christianeugstergmxnet

    I have the code displaying the featured image in the header.php. That seems to be wrong, but I would like to have the image (one image per page) in the header area. Is there another workaround to achieve this?

    Moderator keesiemeijer

    @keesiemeijer

    If you are using a free theme, post a link to your site and theme here and someone may be able to look at its code to help. If you are using a paid theme, we cannot examine its code or options, so you should contact the theme supplier.

    Can you paste and submit the full code of page.php of your theme into a pastebin.com and post the link to it here? see the Forum Rules for posting code and using the pastebin.

    Christian Eugster

    @christianeugstergmxnet

    I am using a free theme and resolved the problem by changing some lines in it (twenty_Ten). I changed the lines:


    <div id="header-image" role="banner">
    <?php
    // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    has_post_thumbnail( $post->ID ) &&
    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
    $image[1] >= HEADER_IMAGE_WIDTH ) :
    // Houston, we have a new header image!
    echo get_the_post_thumbnail( $post->ID );
    elseif ( get_header_image() ) : ?>
    <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    <?php endif; ?>
    </div><!-- #header-image -->

    to:


    <div id="header-image" role="banner">
    <?php
    if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID) )
    {
    echo get_the_post_thumbnail( $post->ID, 'full' );
    }
    elseif (get_header_image() )
    {
    echo '<img src="';
    echo header_image();
    echo ' width="';
    echo HEADER_IMAGE_WIDTH;
    echo '" height="';
    echo HEADER_IMAGE_HEIGHT;
    echo '" alt=""/>';
    }
    ?>
    </div><!-- #header-image -->

    Now it works! Thank you very much for your help!

    Dear, Friends this is my wordpress site wwww.pscguide.com there is featured image option enable but not showing that featured image when i post the article on the site what is the solve of this problem . 🙁

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Featured Image not showing’ is closed to new replies.
Skip to toolbar