Forums

[resolved] Linking to category pages (5 posts)

  1. ixwa
    Member
    Posted 12 months ago #

    I wanted to make sure I understood the template hierarchy logic/link structure properly before launching into building out the category "main" pages and regular pages look-and-feel. I've read a couple of pages referring to this, but it's not working.

    I've created 4 categories with simple one-word slugs. I created 4 associated category-[slug].php files in my theme dir. How do I physically link to these category "main" pages--for example, from a custom header.php nav menu? Deep-link all the way into the themes directory? (This seems weird)

    Right now, none of these work:
    /root/category-[slug].php
    /root/[category slug]/category-[slug].php
    /root/wp/wp-content/themes/mytheme/category-[slug].php --why would I do this??

    Or maybe I'm circumventing an already built-in WP function? (ie: Should I be using a PHP loop to create my header.php nav menu using WP variables?)

    A little confiuzzled here...

  2. esmi
    Theme Diva & Forum Moderator
    Posted 12 months ago #

  3. ixwa
    Member
    Posted 12 months ago #

    esmi, I have read this.

    category-slug.php has not worked. And what comes before the file name? Root? /wp/?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 12 months ago #

    Why are you trying to build the links from scratch? Just use wp_list_categories().

  5. ixwa
    Member
    Posted 12 months ago #

    Aha--that's it! I didn't know what to ask for...because I didn't know that existed.hehe

Reply

You must log in to post.

About this Topic