WordPress.org

Ready to get started?Download WordPress

Forums

Featured Image not displaying (19 posts)

  1. Ajay Udayagiri
    Member
    Posted 10 months ago #

    I've updated my site to WordPress 3.7 today. My site's homepage displays the latest posts with featured image and summary of content.
    Until it is running on WordPress 3.6, it is working normally. The moment I updated it to version 3.7, it stopped displaying featured images of posts on homepage.
    Further, some of the posts in homepage are displaying featured images. I can't get to problem exactly.

    So, I'd like to get help from you.
    Site URL : Review Writer

  2. Krishna
    Volunteer Moderator
    Posted 10 months ago #

    Looks like a theme-specific problem. Check if your site displays featured images if you use a default WordPress theme (say 2012 or 2013).

  3. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Krishna, Thanks for your kind reply.
    If it was a problem with theme, why only few of the posts are displaying featured images? And the theme worked well with WordPress 3.6 version.
    By the way I'll try installing old themes once.

  4. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Hello Krishna,
    I've tried too many themes and I've even re-installed the WordPress. But still the problem persists.
    May I know any other way to solve this issue ?

  5. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    Switch to twentythirteen with no plugins and test it there.

  6. If it was a problem with theme, why only few of the posts are displaying featured images?

    There is an easy way to test: just switch to the Twenty Thirteen theme and see if the featured images are working.

    If the featured images work then it's likely a theme issue. Have you considered contacting the theme author for support?

  7. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    Looks like the images that are not working are getting scaled to 1px X 1px -

    1000px × 1000px (scaled to 1px × 1px)

  8. Ajay Udayagiri
    Member
    Posted 10 months ago #

    I've already tried other themes on the same site.
    The problem still persists.

  9. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Further, I've installed the same other sites. Its is working fine.
    WPyogi, You are right.

  10. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    We need to see the problem in a default theme with ALL plugins deactivated.

  11. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Will do it now

  12. Ajay Udayagiri
    Member
    Posted 10 months ago #

    I've installed Twenty thirteen theme in it. It is displaying the entire content in the homepage. How can I set it to show only summary and featured images?

  13. WPyogi
    Volunteer Moderator
    Posted 10 months ago #

    You'd have to make a child theme and modify theme files - you might want to just look for a theme that has that already - there are lots of really great themes here:

    http://wordpress.org/themes/

  14. CraZ7
    Member
    Posted 10 months ago #

    Had similar problem, in my case pictures where showing up 1px*1px (after 3.7 update), noticed that some images where missing attachment_meta. Generated that and now pictures are showing up fine.

  15. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Cra77, I found that my site is facing the same issue.
    Could you please explain me how to generate attachment_meta.

  16. CraZ7
    Member
    Posted 10 months ago #

    my generator code...

    [ Moderator note: please wrap code in backticks or use the code button. ]

    <?php /* meta generator */
    require ( ABSPATH . 'wp-admin/includes/image.php' );
    $args = array(
        'post_type' => 'attachment',
        'numberposts' => -1,
        'post_status' => null,
        'post_parent' => null, // any parent
        'post_mime_type' => 'image',
        );
    $attachments = get_posts($args);
    $auto_incr_meta = $wpdb->get_var( 'SELECT MAX(meta_id) FROM wp_postmeta' );
    $auto_incr_meta++;
    
    if ($attachments) {
    
        foreach ($attachments as $post) {
                setup_postdata($post);
    if(wp_get_attachment_metadata( $post->ID, false )){
    //echo '1';
    }else{
    //echo '2';
    $data = wp_generate_attachment_metadata( $post->ID, $post->guid );
    	$wpdb->insert(
    	'wp_postmeta',
    	array(
    		'meta_id' => $auto_incr_meta,
    		'post_id' => $post->ID,
    		'meta_key' => '_wp_attachment_metadata',
    		'meta_value' => '',
    	));
    
    wp_update_attachment_metadata( $post->ID, $data );
    $auto_incr_meta++;
    
    //echo $value;
    //break;
    }
        }
    }
    ?>

    Dont now how good this is but it worked for me :) basicly it checks all attachment(image) posts and if they dont have meta it will generate it and then add it to the postmeta table.

  17. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Thanks for the code, CraZ7.

    But, where should I add this code?
    In the theme functions.php ?

  18. CraZ7
    Member
    Posted 10 months ago #

    yes.

  19. Ajay Udayagiri
    Member
    Posted 10 months ago #

    Ok.
    Thanks for your kind reply :)

Reply

You must log in to post.

About this Topic