Support » Themes and Templates » Slow loading category pages – image attachment issue?

  • ebedgert


    I’m using a theme which uses wp_get_attachment_image to implement the display of featured image and thumbnails on the category pages. (I have no use for the thumbnails, so I’ve edited out that part of the code.) I’ve noticed that having multiple posts in a category that have featured images attached to them, results in exponentially slow loading of the category page. I’ve confirmed this by removing all featured images from posts except for one post in each category, which results in a nearly normal load time for the pages.

    This seems like a really excessive delay. You should be able to have many posts in a given category which have an image attached to them, without it affecting the load time of your category page, right? Here is the code I’m looking at and I’m wondering if the theme I’m working with is using this the right way. Is there anything wrong here?

    					while (have_posts()) {
    					$img_description = '';
    					if(get_post_thumbnail_id($post -> ID) )
    						$post_img_big = wp_get_attachment_image(get_post_thumbnail_id($post -> ID),'featured_540x270','' );
    						$img_description = de_getPostImageDescription($post -> ID,get_post_thumbnail_id($post -> ID));
    						$post_img_big = get_first_image($post -> ID,'540x270');	

    The image is printed this way:

    <div class="cat_content">
                  <?php echo $post_img_big; ?>
    						<h2><a href="<?php the_permalink(); ?>" class="link_inv"><?php echo $post -> post_title; ?></a></h2>


Viewing 1 replies (of 1 total)
  • It doesn’t look like it should be slowing anything down too much.

    Do you have a link?

Viewing 1 replies (of 1 total)
  • The topic ‘Slow loading category pages – image attachment issue?’ is closed to new replies.