Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Page & Category Menu Bars (http://forum.bytesforall.com/forumdisplay.php?f=10)
-   -   How to remove parent slug from child page's permalink? (http://forum.bytesforall.com/showthread.php?t=1479)

Tarzanna77 Apr 29, 2009 03:44 PM

How to remove parent slug from child page's permalink?
 
How can I remove parent slug from child page's permalink? This may not be Atahualpa specific, but I can't figure out how to do it... Perhaps there is a plugin that might work?

I use pages (ie. not posts) that are setup as children of a parent page. In my menu bar navigation they appear as

/services/page1.html
/services/page2.html
/services/page3.html

Where what I want is:
/page1.html
/page2.html
/page3.html

(I'm using the "html-on-pages" plugin to add the .html since I'm moving this site over from another server and this is the site structure it currently has.)

Is there anyway to accomplish what I'm looking to do? I've considered NOT using the parent/child option, but I can't have all the actual page names in my navigation, there are way too many and too long. I NEED to be able to use the drop down feature, but I would prefer NOT to have the extra parent name in the url.

Flynn Apr 29, 2009 07:07 PM

The drop downs work either way. The URL paths can be set at Site Admin -> Settings -> Permalinks

Tarzanna77 Apr 29, 2009 09:55 PM

Unless I'm mistaken, I believe those settings only have effect on POST, I'm using PAGES. I'm trying to force wordpress to REMOVE the parent page in the link url... I've found some information online about how to do this for catagories but again, I'm not using catagories, I'm using pages with parent/child submenus.

This is the code I found for catagories:

Quote:

For WordPress 2.7 or higher
open wp-includes/category-template.php
find

$catlink = str_replace( '%category%', $category_nicename, $catlink );

add below

$p = get_category_parents( $category->parent, false, '/', true );
$catlink = str_replace($p, '', $catlink);

save and upload

this little script removes the parent category from Permalink
Is this something I can modify to do the same thing for pages?

Tarzanna77 May 6, 2009 05:51 PM

So far, I've had no luck in finding a plugin or a hack that will allow this to happen. So for anyone who is trying to accomplish the same thing. Here's what I did to work-around the problem. Be forewarned, it's messy. :-)

I only had about 10 pages that I needed to do this for, so if you have alot, I wouldn't recommend doing it this way.

First I installed 2 Plugins to accomplish this. Page Lists Plus and Redirection

First, I moved all my pages that I had created as child pages, OUT from under their parent Page. Then I created new blank child pages, UNDER the parent page, keeping the titles similar so I would know what page it was meant to redirect to. Using the Page Lists Plus options while creating the new pages, I included the "Redirect to" feature and inserted the page I wanted it to redirect to. I also checked "Include in Page Lists" and "Link" boxes.

Then in the Atahualpa Menu bar theme options, I inserted the page ids for all the original pages I had moved OUTSIDE of the in the area to EXCLUDE them from the menu. Otherwise they will all list individually in your menu bar.

I could have stopped here, but I found that the Page Lists Plus redirect still allowed you to access the pages using the parent/xxx.html link, and I did NOT want that to happen. So I used the Redirection Plugin (Options found under Tools) to add permanent redirects to the final page, in the form of: /parent/child.html = www.domain.com/final.html

Since this method creates alot of extra pages with nothing on them, I also use xml sitemaps, and have excluded all the extra pages that are referenced by the parent/child links.

If you want to see it in action you can view my site: http://www.phoenixstorks.com/

Notice how when you go to the drop-down portion of the menu bar, the sub-pages DO NOT have the PARENT page in the url link. THAT is what I needed to accomplish, to be able to keep the same menu navigation from my old site design.

Anyway, I hope this might help someone else looking to do the same thing. I really hope that some plugin developer finds a way to make a plugin to simply remove the PARENT from child pages. But until then, this is the method I'll have to use.

krystyna May 26, 2009 05:44 PM

This is what I need to do too, but in my case I simply need to change the page names to .html. It's that simple. I used the "html on pages" plugin, but while it added the .html, when I clicked on the page names they were "not found." I don't have any "child" pages - at least not on this small site I'm working on.

Also, a page I had retitled "Bio" still shows as "about.html" and I don't know where to change it to say "bio" or "biography."

Flynn May 27, 2009 08:05 AM

You should be able to do this at Site Admin -> Settings -> Permalinks -> Custom Structure, i.e.

/%year%/%monthnum%/%postname%.html

To change the page slug for an existing page, see Pages -> Edit -> [Title of Page] -> Edit -> "Permalink: http://yoursite.com/page-slug/" [Edit]

madmax1404 Jun 5, 2009 04:18 PM

Hi Flynn

That doesn't work. When you edit the page you can edit the permalink but only the name of the page, not the parent page slug.

This issue drives me nuts.

Anybody has an idea?

Tarzanna77 Jan 21, 2010 12:22 PM

Just wanted to add a note here that someone FINALLY created a plugin that works perfectly for this!

http://atastypixel.com/blog/wordpres...om-permalinks/
or http://wordpress.org/extend/plugins/custom-permalinks/ for the plugin download page.

I was able to replace 3 other plugins (Page Lists Plus, Redirection & HTML on Pages) with this one AND remove the extra pages I had to have to get rid of the "Parent" in the url. Now my admin area is nice & clean & uncluttered.

I'm using 2.8.6, not sure if it will work with the most current version of Wordpress. Just a heads up.

I believe this will work for both Posts & Pages, but I've only used it for PAGES.

dgeri Aug 20, 2010 09:02 PM

Hi Tarzanna,

I also needed the same feature and installed the plugin. How are you create the permalink to only show the child pages without changing them manually. For example, in the permalink settings, i typed in /%tag% but the parent still shows up on default. Does this happen to you?

Thanks!

JaneD Aug 21, 2010 01:45 PM

I don't use tags, posts or catagories so I'm not sure if I'm understanding what you need.

The "Custom permalink" plugin I mentioned has it's own option setting when you create a page (I'm assuming it works the same for posts but I've never used it) It has nothing to do with the "built-in" permalink settings Wordpress offers.

When you are creating/editing a post, you should have an option window below your text editor area that says "custom permalink" open that window/area and you will be given a space to name the page whatever you want... it www.yourdomain.com/xxx - you obviously can't change your domain, but whatever comes after that, is whatever you want it to be.

I don't believe the plugin will do this automatically, at least I've set all mine manually, but I only have about 20 pages total on my site so it's not a big deal.

Hope that helps answer your question.


All times are GMT -6. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.