• Ryan

    (@daobydesign)


    Hi, I’ve cruised the forum and came up with nil on how to answer this. Hopefully someone knows of a solution.

    I have a collection of pages (ie. not posts) that are organized as children of a parent page. I then use wp_list_pages() to call the pages and format them into a main navigation menu on the site.

    This works beautifully, but the pages’ permalinks all contain their parent page’s slug. ie.:
    /mainnav/apples/
    /mainnav/oranges/
    /mainnav/bananas/

    Where what I want is:
    /apples/
    /oranges/
    /bananas/

    The only solutions I’ve been able to think up are:
    1. Free float all the pages as parent pages, and link to them directly – problem is, when done in this way no CSS is added to allow for separate styling of “current_page_item”, and it’s pretty fugly in the backend – using child pages keeps everything more organized.

    2. Change the parent page’s slug to something other than “mainnav” – this would work, but I’d much prefer to not have it at all.

    Anyone have any ideas on how to remove the parent’s slug from the child page’s permalink?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Ryan

    (@daobydesign)

    This isn’t a solution exactly, but it did solve one of the thorns in using solution #1 above:

    Create the pages you want to use as menu items, but don’t make them children of any other page. Then to display them, simply use the wp_list_pages(‘include=ID1,ID2,ID3’) where ID1, ID2 and ID3 are a comma-separated list of the page IDs you want as your menu items.

    This gets around the issue of not having the “current_page_item” class added to the page you’re on (for CSS styling of the menu item).

    However, it doesn’t help organize the pages into a more semantical tree, as they’re all just in the main “Pages” bin.

    There must be another solution. No developer here that can fix this?
    Should be not a big deal. I have seen many other people searching for a solution of this issue.

    well, this plugin Page Lists Plus solves the problem:
    http://wordpress.org/extend/plugins/page-lists-plus/

    I found another thread where they were trying to solve this, but were unable to: http://forum.bytesforall.com/showthread.php?t=1479

    Doing the Page Lists Plus thing with redirects isn’t really a solution since you have to set it up individually. There should be a simple way to customize the permalink.

    Has any one got a fix to removing the parent slug from child page’s permalink without using Page Lists Plus ?

    I have the same issue – been searching for a solution to no avail. Had to settle for a workaround – this is what i did and it works just fine – if you have a lot of pages to edit, then this could be a problem – i am planning around 20 pages, so this would be fine for me:

    Install 2 plugins:

    1) Page Lists Plus
    2) LJ Custom Menu Links

    1) Page Lists Plus – go into each page and unplug (checkbox) the page from the page menu. Update the page. Correct the parent path on the right menu to indicate no parent. Check your permalink and copy the URL

    2) LJ Custom Menu Links – Go to Settings and LJ Custom Menu Links, start building your page links manually, it has a parent structure and paste you URL with your chosen link text.

    Works like a charm on WordPress 2.8+ – You can see it in action on http://www.profitworx.com – you can go into complex and in depth menus, i haven’t yet but did test it.

    Hope this helps.

    I’m not sure if you guys are still looking for a solution for this, but I found the perfect one: http://wordpress.org/extend/plugins/custom-permalinks/

    Enjoy!

    Thanks rocomu8 – The solution above is excellent and solves the problem – i replaced my long fix with the Custom-Permalinks plugin – works great

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to remove parent slug from child page’s permalink’ is closed to new replies.