• I have a page that makes 47 calls to the database, which makes the page pretty slow to draw. I would like to trim that down with some more efficient code you can see the page here.

    There are three different spots where the following code is (for station news, programmer’s notes, and podcasts):

    <?php
     $posts = get_posts('numberposts=7&category=225');
     foreach($posts as $post) :
     setup_postdata($post);
     ?>
        <div class="post" id="post-<?php the_ID(); ?>">
    
    	<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    </div><!-- CLOSE post -->
    <?php endforeach; ?>

    Is this where I can be more effiecent? Otherwise, does anybody have ideas to make the page load quicker?

    In advance, thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi

    I am not an optimization guru but am aware of key issues. I looked at your site. Your queries above look fine.

    I ran your site through the Firebug network profiler. (If you don’t have Firebug installed in your Firefox, you need to. If you do and don’t know how to use the network profiler, you should learn) There are two places when loading your page that are getting hung up for 6 and 7 seconds
    The first
    http://www.valleyfreeradio.org/wp-content/plugins/ajaxd-wordpress/js/core.js.php?ver=2009-01-25_22:21:59

    The second
    http://www.valleyfreeradio.org/wp-content/plugins/ajaxd-wordpress/js/core.css.php

    You might want to disable that plugin and see if your site loads a lot faster. If it does, you can then investigate why its taking 13 seconds to load.

    You are also getting hung up waiting for Google (calendar) and sharethis.com to respond to your requests.
    try disabling the calendar plugin and see what difference that makes in page load time.

    You have a lot of plugins that seem to be loading JS and code on every page. Look at your View Source page and observe the code that is loading. If you can find a way to only load a plugin’s code on the pages it is actually being used, that speeds up your load time. The Google calendar looks like an offender.

    Suggestions: Instead of having each of your groups (“join us” for example) of GIF files be a separate GIF file, combine them all into a single GIF file and use CSS to manipulate which part of the image displays with each use of that image file – this uses them as background images. So instead of calling the webserver 6 times you are calling it once. Here is a good article on the technique
    http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/

    Here is a good article on WP optimization
    http://www.prelovac.com/vladimir/wordpress-optimization-guide

    I lived in the Pioneer Valley for many years
    take care

    Thread Starter Bill Weye

    (@billhector)

    thanks very much for your ideas! much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trimming my DB calls — how to?’ is closed to new replies.