WordPress.org

Ready to get started?Download WordPress

Forums

Images from media library not showing in category list (5 posts)

  1. Loofah
    Member
    Posted 2 years ago #

    Similar to this thread - http://wordpress.org/support/topic/media-lib-does-not-show-attached-to-details-for-many-existing-posts

    I create a new post, insert an image from the media library which shows in the posting OK. If I then browse by category, the title and summary are there, but no image thumbnail.

    The image in question is in the media library and attached to another post, can you not use the same image twice??

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Your theme may be using <?php the_excerpt();?> instead of <?php the_content();?> in its template files. Try editing the relevant template file(s) and replacing <?php the_excerpt();?> with <?php the_content();?>

  3. Loofah
    Member
    Posted 2 years ago #

    Hmm, I found one instance of <?php the_excerpt();?> and replaced as suggested, that was in archive.php. The result was that the category displayed the entire posting but still no thumbnail...

    Any ideas on where other instances may be?

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    It definitely sounds like a theme issue but you'd need to go through all of the theme's files to find the source of the problem.

  5. Loofah
    Member
    Posted 2 years ago #

    Could this be the source? I found it in 'functions.php'

    # Displays post image attachment (sizes: thumbnail, medium, full)
    function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') {
    	if ($postid<1) $postid = get_the_ID();
    	if ($images = get_children(array(
    		'post_parent' => $postid,
    		'post_type' => 'attachment',
    		'numberposts' => 1,
    		'post_mime_type' => 'image',)))
    		foreach($images as $image) {
    			$attachment=wp_get_attachment_image_src($image->ID, $size);
    			?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php

Topic Closed

This topic has been closed to new replies.

About this Topic