• Hi,

    I have this strange problem with the custom post loop I have in one of my custom page template. The browser is throwing a compression error. Error screenshot: https://i40.tinypic.com/zy8pk7.png

    I have also enabled my Gzip compression on the blog.

    The code which is causing the problem is this:

    <?php
    /* Template Name: Custom Blog
     */
    
    get_header();
    ?>
    <div class="pagenev"><div class="conwidth"><?php design_breadcrumbs() ?></div></div>
    <div id="container">
        <div id="content">
    
            <?php
            $args = array('cat' => 18, 'showposts' => 5);
    
            query_posts($args);
    
            if (have_posts()) : while (have_posts()) : the_post();
                    ?>
    
                    <!-- Blog Entry -->
                    <div class="blog_entry">
                        <!-- Inside -->
                        <div class="inside">
    
                            <h2 class="post-title"><a>"><?php the_title(); ?></a></h2>
                            <div class="date"><?php the_time('F l, Y'); ?> at <?php the_time('g:i a'); ?> </div>
                            <div class="comments">Comments: <?php echo get_comments_number(); ?></div>
                            <br class="clear" />
                            <?php
                            $attr = array('class' => "one_col_shadow_img");
                            the_post_thumbnail('blogs', $attr);
                            ?>
                            <p class="biglines"><?php echo get_the_excerpt(); ?></p>
    
                            <br class="clear" />
                        </div>
                        <!-- /Inside -->
                    </div>
                    <!-- /Blog Entry -->
    
                <?php endwhile; ?>
    
                <div id="page-nav">
                    <div class="alignleft"><?php previous_posts_link('? Previous Entries') ?></div>
                    <div class="alignright"><?php next_posts_link('Next Entries ?', '') ?></div>
                </div>
            <?php else: ?>
    
                <h1 class="arc-post-title">Sorry, we couldn't find anything that matched your search.</h1>
    
                <h3 class="arc-src"><span>You Can Try Another Search...</span></h3>
                <?php get_search_form(); ?>
                <p><a>" title="Browse the Home Page">? Or Return to the Home Page</a></p>
    
            <?php
            endif;
            paginator();
            wp_reset_query();
            ?>
    
            <br class="clear" />
    
        </div>
    
    </div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Code that is similar but working fine:

    <?php
    /* Template Name: Blog
     */
    get_header();
    ?>
    <div class="pagenev"><div class="conwidth"><?php design_breadcrumbs() ?></div></div>
    <div id="container">
        <div id="content">
    
            <?php
            $args = array('post_type' => 'post', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), 'cat' => 18);
            query_posts($args);
    
            if (have_posts()) : while (have_posts()) : the_post();
                    ?>
                    <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
                        <h2 class="post-title"><a>"><?php the_title(); ?></a></h2>
                        <div class="posted_on">Posted on: <?php the_date('j F, Y'); ?> </div>
                        <? /* <span class="postmetadata"><h3><?php the_time('F j, Y'); ?></h3><div class="content-ver-sep"> </div><h2>By: <?php the_author_posts_link() ?></h2><h5><?php comments_popup_link('No Comments Yet?', '1 Comment ?', '% Comments ?'); ?></h5>Posted in <?php the_category(', ') ?><?php the_tags('Tags: ', ', ', ''); ?><h5><?php edit_post_link('Edit This Post'); ?></h5></span> */ ?>
                        <div class="entrytext"><div class="thumb"><?php the_post_thumbnail(); ?></div>
                            <?php add_filter('the_excerpt', 'excerpt_read_more_link'); ?>
                            <div class="clear"> </div>
                        </div>
                        Comments: <?php comments_number('0', '%', '%'); ?> |
                    <a>">Leave comment</a>
                    </div>
                    <div class="content-ver-sep"></div>
                <?php endwhile; ?>
    
                <div id="page-nav">
                    <div class="alignleft"><?php previous_posts_link('? Previous Entries') ?></div>
                    <div class="alignright"><?php next_posts_link('Next Entries ?', '') ?></div>
                </div>
    
            <?php else: ?>
    
                <h1 class="arc-post-title">Sorry, we couldn't find anything that matched your search.</h1>
    
                <h3 class="arc-src"><span>You Can Try Another Search...</span></h3>
                <?php get_search_form(); ?>
                <p><a>" title="Browse the Home Page">? Or Return to the Home Page</a></p>
    
            <?php endif;
            wp_reset_query();
            ?>
    
        </div>
    
        <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Can anyone spot where the problem is in the first block of code that is resulting in a compression error being thrown by browsers.

    Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WordPress custom loop and Gzip compression error’ is closed to new replies.