WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] slow load - OD'ing on queries? maybe post_groupby would help? (4 posts)

  1. wesbroadway
    Member
    Posted 6 years ago #

    greetings - page is located at: wesbroadway.com/wordpress. (css needs some ironing - least of my worries at this point)

    problem - this page/theme loads slow. i'm thinking it might have to do with the fact that i'm making 6 individual queries for my content section on the front page. i'm shooting for a newspaper-type front-page actually - a top story, 2 featured stories , and then one story from each of my 4 categories.

    so: a thought i had is that i could reduce my 2 featured stories down to one, and then i'm looking at a fantastic GROUPBY possibility on my categories. however, for the life of me i can't understand the docs/forum q's on post_groupby. i also don't know what or where the field is for the post category. scanning my SQL tables (wp_posts.post_category), i've got zero's all the way down. (i know i'm missing something here).

    back to GROUPBY - i might understand the add_filter('post_groupby', 'groupby_function') concept, but i don't understand the function aspect of it. i've tried throwing in a couple scripts that i found into the default theme's index.php page, but it seemed to have zero effect. specifically, i added these lines:

    ----------------
    function plw123ngb_posts_groupby( $groupby ) {
    if( preg_match( "/(|[ ,.])id(|[ ,])/i", $groupby ) )
    $groupby = 'post_category';
    return $groupby;
    }

    add_filter( 'posts_groupby', 'plw123ngb_posts_groupby' );
    ----------------

    it appears to not apply this filter at all. i've since switched back to the layout i'm shooting for, so that anyone who might be kind enough to help me on this can see specifically what i'm shooting for.

    short version: can you use one query to select one item from each of 6 categories? how? thanks much in advance, kind regards...

  2. TrishaM
    Member
    Posted 6 years ago #

    I notice that you're performing a browser check in your <head> section first before loading stylesheets - this could slow load time because the page needs to first figure out which stylesheet to use....

    You might consider putting that check into your primary stylesheet instead using @import to import the additional styles needed for IE7/IE6, which will override styles in the primary for those browsers.

    This way your primary styles will begin loading faster which should make your page render faster.....

  3. wesbroadway
    Member
    Posted 6 years ago #

    thank you, that's a fine point. i definitely need to get those things out. but any lag from that check should only apply to users with IE, right? firefox has same slowness, and would ignore those lines as HTML comments, i'd think...

    am i off-base to think that i can (somewhat easily) re-jig everything so that those IE7/6 sheets aren't needed? they came with the theme before i dissected/rebuilt it, and i've always done everything possible to avoid using the IE conditionals. considering how awful it renders in IE6, i've obviously got to do some more work on the thing anyway... thanks again!

  4. wesbroadway
    Member
    Posted 6 years ago #

    rebuilt theme, gonna close this thread. thanks all...

Topic Closed

This topic has been closed to new replies.

About this Topic