WordPress.org

Ready to get started?Download WordPress

Forums

Category pages display server error (14 posts)

  1. kristastryker
    Member
    Posted 1 year ago #

    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...

  2. wpismypuppet
    Member
    Posted 1 year ago #

    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 :)

  3. kristastryker
    Member
    Posted 1 year ago #

    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...

  4. wpismypuppet
    Member
    Posted 1 year ago #

    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.

  5. kristastryker
    Member
    Posted 1 year ago #

    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>
  6. wpismypuppet
    Member
    Posted 1 year ago #

    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.

  7. kristastryker
    Member
    Posted 1 year ago #

    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?

  8. wpismypuppet
    Member
    Posted 1 year ago #

    Show me the new error log

  9. kristastryker
    Member
    Posted 1 year ago #

  10. wpismypuppet
    Member
    Posted 1 year ago #

  11. wpismypuppet
    Member
    Posted 1 year ago #

    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(); ?>

  12. kristastryker
    Member
    Posted 1 year ago #

    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?

  13. kristastryker
    Member
    Posted 1 year ago #

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

  14. wpismypuppet
    Member
    Posted 1 year ago #

    You are welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic