• Resolved williamchan04

    (@williamchan04)


    HI~
    I am trying to call background images using conditional tag for each archive & pages. Somehow, the background images are taking so long to display, I am sure that is my function causing it, but don’t know why,
    The images are only 900px X400px ,and it’s taking 10seconds to load please help =D

    <div id="header"  style="background:url(<?php if (in_category(8)) {
    				echo '/wp-content/uploads/2013/08/tour_3-011.png';
    			}elseif(in_category(4)) { 
    
    				echo '/wp-content/uploads/2013/08/local-011.png';
    }>

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am guessing the speed has something to do with the server or the images themselves, but hard to know without seeing the site. Just to make sure it isn’t the PHP processing time, you could move that stuff to your stylesheet.

    .category-4 #header {
       background:url('/path/img.jpg');
    }
    
    .category-2 #header {
       background:url('/path/img2.jpg');
    }
    Thread Starter williamchan04

    (@williamchan04)

    Thank you, It seems to be the problem of my server, it works fine now after changing to another server =D

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Small size image with extremely long loading time’ is closed to new replies.