WordPress.org

Ready to get started?Download WordPress

Forums

Subcategories and "nice" permalinks (20 posts)

  1. flyingrabbit
    Member
    Posted 9 years ago #

    Basically, the one thing keeping me from switiching from MT to WordPress is the URI issue. Right now, there's a nightly build that'll let me structure URIs like /categoryname/postname, but what I (and several others, I've noticed) need is to be able to have URIs like:
    /parentcategoryname/subcategoryname/postname/.
    My knowledge of PHP is small; I can do little tiny adjustments here and there, but this is beyond me. It seems, though, that it wouldn't be too difficult to include this feature, since a simlar one (for categories) already exists.
    thanks.

  2. awh
    Member
    Posted 9 years ago #

    I think WordPress 1.2 has that.

  3. Stevarino
    Member
    Posted 9 years ago #

    How would that URI structure handle multiple categories or subcategories?

  4. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    /%category%/%postname%/ can handle /parentcategoryname/subcategoryname/postname/; however, when the permalinks are generated, the parent categories are not, at the moment, included. Only the leaf subcat is included. I'll try to fix this for 1.3. Generating permalinks for multiple categories isn't possible. %category% can only match one category. A category hierarchy is considered one category.

  5. Lorelle
    Member
    Posted 9 years ago #

    Was this "category/subcategory/postname" ever "fixed" and completed? So far, I only see category/postname.

    I'd love it, and I've seen it frequently requested.

  6. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    Thanks for reminding me. I just checked it in. Keep in mind that if a post has multiple categories, the first category in the list is used to generate the permalinks.

  7. Lorelle
    Member
    Posted 9 years ago #

    Wow! I'll take a look at it. Will this go into 1.5 or is this a dyi change? Thank YOUOUOUOUOUOU

  8. Lorelle
    Member
    Posted 9 years ago #

    Okay, I'm looking at this change, and I've added it to the template-functions-links.php, but how should I use this?

    Just select %category% or is there a %category%/%subcat%/ permalink to add? Will this just add the sub automatically?

    I think this is brilliant, I just need a little more detail. You are awesome!

  9. Lorelle
    Member
    Posted 9 years ago #

    Okay, copied the changes into the appropriate php file, then set my permalinks to be:

    /%category%/%postname%/

    Based on the implications in the notes at permalinks and subcategories in the CVS, I kept it to this. I checked the htaccess to make sure the permalink changes were embedded, and now I can't view anything - I just get post not found.

    I took out the permalinks reference to nothing again and updated the htaccess (clicked the button - I like the ease of this when the htaccess file is writable) and I'm back to normal, but without any permalinks.

    Ideas?

  10. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    What version of apache? Some versions seem to have regular expressions that are greedy by default which messes up /%category%/%postname%/ since both tags are greedy.

  11. Lorelle
    Member
    Posted 9 years ago #

    Here is my server info:

    FreeBSD 4.9-RELEASE
    mysql Ver 12.22 Distrib 4.0.18
    perl, v5.8.3
    PHP 4.3.4

  12. Lorelle
    Member
    Posted 9 years ago #

    Also, is it right that all I have to do is put /%category%/%postname%/ and if the post is in a subcategory, the results would be:

    /category/subcat/postname/

    Right? If so, slickooooh!

  13. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    Yes, that's right.

  14. Lorelle
    Member
    Posted 9 years ago #

    and the server info?

  15. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    I don't see the apache version in there. Here's something you can do to help debug. For the last rewrite rule, replace '[QSA,L]' with '[QSA,L,R]'. Visit a post permalink and look at the URI in your browser's location field. You should see a query string style URI instead of a cruft-free URI. This will show you what name and category_name are being set to.

  16. Lorelle
    Member
    Posted 9 years ago #

    I added the R to a bunch of things in the end section and this is what I got:
    /wordpress/index.php?category_name=learning/introduction-to-the-internet/

    It should be:

    /wordpress/learning/internet/introduction_to_the....

    And a solid POST NOT FOUND.

    I'm trying to figure out how to find the apache info on my server. Haven't found it yet.

  17. Lorelle
    Member
    Posted 9 years ago #

    Rborn:

    I found the Apache info, and I hope this helps:

    Apache Version Apache/1.3.31 (Unix) mod_log_bytes/0.3 FrontPage/5.0.2.2635 PHP/4.3.10 mod_ssl/2.8.19 OpenSSL/0.9.7d
    Apache Release 10331100
    Apache API Version 19990320

  18. Lorelle
    Member
    Posted 9 years ago #

    Rboren:
    Sorry for mispelling your name. I'm working with one hand on the keyboard cuz I decided to do a slicing job on my left hand and go for the new look of having six fingers. Didn't work. Much apologies during my handicapped healing.

    Lorelle

  19. Ali_ix
    Member
    Posted 9 years ago #

    Keep on men !
    I need it to ... ;)
    I have tried to change the $cats variable 4 permalink sturture to returne child + parent or as u said sub category + Parent categori ...but it didnt work ;)

  20. Lorelle
    Member
    Posted 9 years ago #

    How did you specifically list your permalinks, Ali?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.