1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Defining Custom WordPress Link Structure

Discussion in 'PHP & Perl' started by Slingshot377, Aug 3, 2009.

  1. Slingshot377

    Slingshot377 Newbie

    Joined:
    May 2, 2009
    Messages:
    27
    Likes Received:
    2
    Alright, so I have been trying to solve this issue for a while.

    I am trying to achieve this link structure for the categories and posts on my website [http://www.MovieReserve.com]

    Code:
    Movies:
    Action - http://www.moviereserve.com/movies/action/
    Animation - http://www.moviereserve.com/movies/animation/
    Comedy - http://www.moviereserve.com/movies/comedy/
    Drama - http://www.moviereserve.com/movies/drama/
    Fantasy - http://www.moviereserve.com/movies/fantasy/
    Horror - http://www.moviereserve.com/movies/horror/
    Romance - http://www.moviereserve.com/movies/romance/
    Sci-Fi - http://www.moviereserve.com/movies/sci-fi/
    Sports - http://www.moviereserve.com/movies/sports/
    Suspense - http://www.moviereserve.com/movies/suspense/
    Thriller - http://www.moviereserve.com/movies/thriller/
    
    TV Shows:
    Action - http://www.moviereserve.com/tvshows/action/
    Animation - http://www.moviereserve.com/tvshows/animation/
    Comedy - http://www.moviereserve.com/tvshows/comedy/
    Drama - http://www.moviereserve.com/tvshows/drama/
    Fantasy - http://www.moviereserve.com/tvshows/fantasy/
    Horror - http://www.moviereserve.com/tvshows/horror/
    Romance - http://www.moviereserve.com/tvshows/romance/
    Sci-Fi - http://www.moviereserve.com/tvshows/sci-fi/
    Sports - http://www.moviereserve.com/tvshows/sports/
    Suspense - http://www.moviereserve.com/tvshows/suspense/
    Thriller - http://www.moviereserve.com/tvshows/thriller/
    
    I could solve this by setting the link structure to /%category&/%postname% but that doesn't work perfectly as although I have 2 parent categories (Movies and TV Shows) with the other categories stemming from them, I can't assign the same slug to two different categories.

    I tried the Advanced Permalinks plugin, but that will only change the structure for posts and not the category itself.

    I tried the Custom Permalinks plugin, but that will only change the structure of the category and not for the posts within the category.

    I tried using both, but that makes both the category and the posts within them get an error (webpage not found for category and 404 for post).
     
  2. lord

    lord Junior Member

    Joined:
    Jan 21, 2009
    Messages:
    176
    Likes Received:
    251
    you use this plugin http://wordpress.org/extend/plugins/decategorizer/

    then you make 2 categories : movies and tvshows

    then you make the other categories and you choose the parent to be whichever category you want (so you will practically have subcategories)

    you welcome :)
     
  3. Slingshot377

    Slingshot377 Newbie

    Joined:
    May 2, 2009
    Messages:
    27
    Likes Received:
    2
    That won't solve the problem...
     
  4. j4froc

    j4froc Registered Member

    Joined:
    Sep 19, 2008
    Messages:
    60
    Likes Received:
    8
  5. Slingshot377

    Slingshot377 Newbie

    Joined:
    May 2, 2009
    Messages:
    27
    Likes Received:
    2
    Okay, that is really similar to what I need done, thanks :D


    Basically what I need to do is get WP to allow 2 categories to have the same slug, as long as their parents are different.

    This way, /movies/action and /tvshows/action would be able to coexist.


    Does anyone know how to accomplish this?
     
  6. lord

    lord Junior Member

    Joined:
    Jan 21, 2009
    Messages:
    176
    Likes Received:
    251
    with my method it can be done
    2 cats -> movies and tvshows

    all the subcategories you want, including action twice, but you have to set up the parent of that subcategory

    after that you use the plugin i gave you and presto you have the urls you wish
     
  7. Slingshot377

    Slingshot377 Newbie

    Joined:
    May 2, 2009
    Messages:
    27
    Likes Received:
    2
    All that plugin does is remove the category base /category/ from URLs. I have already done that. I still can't have /tvshows/action/ AND /movies/action/.

    What I need to do is allow 2 categories to have the same slug while under different parent categories.

    /tvshows/action/
    /movies/action/

    The BLUE is the parent category slug. They are different. No problem here.
    The RED is the child category slug. They are the same. Wordpress does not allow this by default, as it thinks I will end up with one url being assigned to two categories. However, since I am using parent categories and only one child per parent category will have the slug, I will not end up with duplicate links. I just need Wordpress to allow me to assignt he same slug to both categories.
     
  8. lord

    lord Junior Member

    Joined:
    Jan 21, 2009
    Messages:
    176
    Likes Received:
    251
    in my 2.8.3 wordpress i can do that, i have 2 main categories, named test1 and test2 and then i creat a subcategory for each of them, named test in both situations, AND IT WORKS

    i don't understand what you're doing wrong, but i presume that you might not choose the parent when you create the category