Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Page & Category Menu Bars »

How to remove parent slug from child page's permalink?


  #1  
Old Apr 29, 2009, 03:44 PM
Tarzanna77
 
10 posts · Apr 2009
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.
  #2  
Old Apr 29, 2009, 07:07 PM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
The drop downs work either way. The URL paths can be set at Site Admin -> Settings -> Permalinks
  #3  
Old Apr 29, 2009, 09:55 PM
Tarzanna77
 
10 posts · Apr 2009
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?
  #4  
Old May 6, 2009, 05:51 PM
Tarzanna77
 
10 posts · Apr 2009
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.
  #5  
Old May 26, 2009, 05:44 PM
krystyna
 
121 posts · Apr 2009
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."
  #6  
Old May 27, 2009, 08:05 AM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
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]
  #7  
Old Jun 5, 2009, 04:18 PM
madmax1404
 
1 posts · Jun 2009
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?
  #8  
Old Jan 21, 2010, 12:22 PM
Tarzanna77
 
10 posts · Apr 2009
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.
  #9  
Old Aug 20, 2010, 09:02 PM
dgeri
 
1 posts · Aug 2010
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!
  #10  
Old Aug 21, 2010, 01:45 PM
JaneD
 
72 posts · Jan 2009
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.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Permalink or 404 error - page not displaying correctly woolef Atahualpa 3 Wordpress theme 19 Apr 4, 2010 02:08 PM
Paged comments in Permalink Matthuffy Comments, trackbacks & pings 2 Jul 3, 2009 09:17 PM
How to remove arrow indicating child pages in pagebar? Astra Shirahata Page & Category Menu Bars 2 May 17, 2009 02:29 PM
Making a 'child page' password protected when it holds a forum Steven Atahualpa 3 Wordpress theme 2 Mar 31, 2009 06:11 PM
Page Menu Drop Down Only Showing First 6 Child Pages LabbyRoad Page & Category Menu Bars 4 Mar 11, 2009 11:40 AM


All times are GMT -6. The time now is 07:08 PM.


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