• hi all,

    i’ve setup 2 category templates based on the info in the codex. one of them works fine, but the other just shows my ‘not found’ message.

    i’ve created these based on category slug, and double checked to make sure the slugs are correct.

    category-case-studies.php
    category-tech-blog.php

    The case studies one works fine and shows an archive of my posts in that category, but the tech-blog one shows ‘not found’. i have 2 posts in the tech-blog cat, and i can view them just fine when previewing the individual posts (i’m using a cat single post template – single-tech-blog.php).

    I’ve even tried pasting all my code from category-case-studies.php into category-tech-blog.php and it still doesn’t work.

    what could i be doing wrong?

    thanks!!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Are both posts in the top level tech-blog category? Are are they in a child category?

    Thread Starter BSK

    (@vdsn)

    thanks for getting back. both posts are in the top-level tech-blog category.

    Thread Starter BSK

    (@vdsn)

    fyi – the page is showing my ‘not found’ message that’s in my template, NOT my 404.php just to be clear. thanks!

    the page is showing my ‘not found’ message that’s in my template

    Would that be category-tech-blog.php? If so, have you tried dumping the $query object to the screen to see what is actually being called from the database?

    Thread Starter BSK

    (@vdsn)

    Would that be category-tech-blog.php?

    Yes

    If so, have you tried dumping the $query object to the screen to see what is actually being called from the database?

    No. How can i do this?

    Thanks again!

    Try adding:

    <?php echo '<pre>';
    print_r($wp_query);
    echo '</pre>';?>

    just before the start of the Loop.

    Thread Starter BSK

    (@vdsn)

    thanks. a lot of things appear. is there something specific i should look for?

    this shows at the bottom.

    [queried_object] => stdClass Object
            (
                [term_id] => 43
                [name] => Tech Blog
                [slug] => tech-blog
                [term_group] => 0
                [term_taxonomy_id] => 44
                [taxonomy] => category
                [description] =>
                [parent] => 0
                [count] => 2
                [cat_ID] => 43
                [category_count] => 2
                [category_description] =>
                [cat_name] => Tech Blog
                [category_nicename] => tech-blog
                [category_parent] => 0
            )
    
        [queried_object_id] => 43
    )

    Can you see the content for the two posts in that query dump?

    Thread Starter BSK

    (@vdsn)

    hi there – no, I don’t see the actual content anywhere in the query dump.

    Thread Starter BSK

    (@vdsn)

    any guesses on what could be causing the content not to appear? thanks again for your help!

    Drop a copy of the file into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Thread Starter BSK

    (@vdsn)

    Ok, the pastebin url is here.

    Thanks!!

    That looks fine. Perhaps there is something in header.php or functions.php that is causing a problem?

    Thread Starter BSK

    (@vdsn)

    it’s weird because i have another category template that is working just fine. I’ve looked at the php files and they’re the same – only difference is the filename (category-cat-slug.php).

    i did see a thread about duplicate cat slugs causing conflicts. i reviewed my slugs and there are no duplicates.

    thanks again for you time!!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘category template not working’ is closed to new replies.