• Recently my category pages stopped working and started displaying an internal server error instead, like this: http://www.12minuteathlete.com/workouts/

    I’ve tried disabling my plugins, deleting my .htaccess file, and updating wordpress, without any luck. I was told to look at my error log, and it seems the problem could be hidden in there but I have no idea which error could be causing it. Here’s the log: http://pastebin.com/n7RXHxWH

    Does anyone have any ideas of how to fix this? I would be eternally grateful…

Viewing 13 replies - 1 through 13 (of 13 total)
  • wpismypuppet

    (@wordpressismypuppet)

    Hmmm… looks like you have a few issues, but the one in question might be related to your archive.php file. Looks like you have an IF statement that has not be properly closed. Maybe you are missing curly braces or something. Can you show the code for that file?

    Just as an FYI, Chrome gives the 500 server error, but Firefox just shows a white screen. This leads me to believe it’s a PHP error. That and the fact you have a PHP error in your log is pretty strong evidence 🙂

    Thread Starter kristastryker

    (@kristastryker)

    I was thinking the same thing… here’s the code to the archive.php file: http://pastebin.com/ypEDVzSD

    Thanks so much for your help! I really need to learn to code…

    wpismypuppet

    (@wordpressismypuppet)

    Ok, the problem is you have this line:

    if(is_archive() && have_posts()) :

    but you never close it. That looks like the only issue. You just need to add:

    <?php endif; ?>

    Wherever you need to end your if statement. It’s interesting you have is_archive() in that statement since you are on archive.php. Anyways, I didn’t look too much into what your code is doing, but that’s what’s breaking it. Fix that and your 500 error should go away.

    Thread Starter kristastryker

    (@kristastryker)

    Ok wait… so when I look at that part of the code, it seems like there are actually two <?php endif; ?> pieces already. Where would I put another one? See this part of it:

    <div id="pageHead">
    <?php global $post; if(is_archive() && have_posts()) :
                        if (is_category()) : ?>
                             <h1><?php single_cat_title(); ?></h1>                   
                             <?php if(strlen(category_description()) > 0) echo category_description(); ?>
                        <?php elseif( is_tag() ) : ?>
                             <h1><?php single_tag_title(); ?></h1>
                        <?php elseif (is_day()) : ?>
                             <h1>Archive <?php the_time('M j, Y'); ?></h1>
                        <?php elseif (is_month()) : ?>
                             <h1>Archive <?php the_time('F Y'); ?></h1>
                        <?php elseif (is_year()) : ?>
                             <h1>Archive <?php the_time('Y'); ?></h1>
                        <?php elseif (isset($_GET['paged']) && !empty($_GET['paged'])) : ?>
                             <h1>Archive</h1>
                        <?php endif; ?>
    
                   <?php endif; ?>
              </div>

    wpismypuppet

    (@wordpressismypuppet)

    That’s what I wasn’t sure of. It looks like you are starting the traditional WordPress loop with:

    <?php global $post; if(is_archive() && have_posts()) :

    And as far as I can see, that’s the one that’s never closed. Maybe move that line to right below:

    <?php get_header(); ?>

    And then add <?php endif; ?> to right before the very last line, <?php get_footer(); ?>. If it doesn’t look right, you can always move it around. But at least this way it’ll be error free.

    Thread Starter kristastryker

    (@kristastryker)

    So… I tried this but the category pages are giving me the same result. Here’s the new code: http://pastebin.com/ysCNKV3u

    Does that look right? Do I maybe need to look somewhere else for the problem?

    wpismypuppet

    (@wordpressismypuppet)

    Show me the new error log

    Thread Starter kristastryker

    (@kristastryker)

    wpismypuppet

    (@wordpressismypuppet)

    wpismypuppet

    (@wordpressismypuppet)

    You know what, it’s late. Ignore my code. I think the only other issue you’re facing is this line (line 6 in pastebin):

    <?php if(strlen(category_description()) > 0) echo category_description(); ?>

    it’s missing a colon (:). Should look like:

    <?php if(strlen(category_description()) > 0): echo category_description(); ?>

    Thread Starter kristastryker

    (@kristastryker)

    Hmm… ok it’s getting closer… the pages no longer show a server error, but they’re not correctly showing the archived posts. See here: http://www.12minuteathlete.com/recipes/

    and here:

    http://www.12minuteathlete.com/workouts/

    They should appear the same as the home page. Any suggestions?

    Thread Starter kristastryker

    (@kristastryker)

    Oh wow, it just worked! Thanks so much for all your help!

    wpismypuppet

    (@wordpressismypuppet)

    You are welcome.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Category pages display server error’ is closed to new replies.