Community Forums › Forums › Archived Forums › General Discussion › Permalink structure for pages
Tagged: permalinks
- This topic has 5 replies, 2 voices, and was last updated 9 years, 10 months ago by
CookieX.
-
AuthorPosts
-
May 8, 2015 at 4:49 am #150874
CookieX
ParticipantHi,
I use the following permalink structure on my website: Domain.com/%category%/%postname%
This works and intended for blog posts. However it does not include pages. Does someone know how I can create the same structure for pages?Thank you in advance.
May 8, 2015 at 11:03 am #150967Marcy
ParticipantThere are no categories for pages, so WordPress will just list the /%postname%
If you want another slug (url section) in front of your page names, you can use a parent-child relationship.
So you would have one page, let's say Parent 1 with slug parent-1
Then the child pages of that parent would be:
Page name Child 1 and slug would be /parent-1/child-1/To do this you would go to the Edit page, and look in the right sidebar, and find the section Page Attributes. Then you can assign any pages you like to a page that you choose as the parent. You can use the Order field to number the child pages in the order you choose.
Marcy | Amethyst Website Design | Twitter
May 9, 2015 at 4:37 am #151193CookieX
ParticipantOh I never noticed that possibility before. Anyhow, it solves the problem almost.
I does in fact create the structure (slug) that I desire.Structure
Domain.com/Japan/child/
Domain.com/Korea/child/Problem
When playing around I noticed a problem.
If I type in Domain.com/child one would expect a "Not found, error 404" but instead in redirects to Domain.com/Japan/child/Any idea why this happens?
May 9, 2015 at 2:42 pm #151313Marcy
ParticipantThe parent/child relationship changed the original page permalink and so it's redirecting from the old permalink to the new one.
But I remembered something else. You can add categories to pages with this plugin
Then to have them display at the bottom of your pages you need to add this to your functions.php
//* Customize the entry meta in the entry footer (requires HTML5 theme support) add_action('genesis_entry_footer', 'custom_page_post_meta'); function custom_page_post_meta() { if ( 'page' === get_post_type() ) { $cats = get_the_category_list( $before = '', $sep = ', ', $after = '', $post_id ); $tags = get_the_tag_list( $before = '', $sep = ', ', $after = '', $post_id ); if ( $cats || $tags ) { echo '<footer class="entry-footer"><p class="entry-meta">'; if ($cats) { echo '<span class="entry-categories">Filed Under: ' . get_the_category_list( ', ', $post_id ) . '</span>'; } if ($tags) { echo '<span class="entry-tags">Tagged With: ' . $tags . '</span>'; } echo '</p></footer>'; } }
You can read a lot more on this forum post
http://www.studiopress.community/topic/adding-tags-categories-in-genesis-child-theme-pages/
Marcy | Amethyst Website Design | Twitter
May 9, 2015 at 5:00 pm #151339CookieX
ParticipantHello Marcy,
I want to start by saying, thank you for your efforts to help me.
However my problem remains. I tried usting the plugin together with permalink structure Domain.com/category/postname, it works as posts but still not when it comes to pages. (Even after categories are added to pages with the plugin)This means that I'm still at this point.
Structure
Domain.com/Japan/child/
Domain.com/Korea/child/Problem
If I type in Domain.com/child one would expect a “Not found, error 404″ but instead in redirects to Domain.com/Japan/child/. (I mean the person typing in domain.com/child intended to visit domain.com/korea/child)Basically what I need to achieve is the structure mentioned above and when wrong url is typed in a 404 should appear, not redirection to one of the pages.
May 9, 2015 at 5:12 pm #151341CookieX
ParticipantNever mind, it seems to be working now. Something was not working properly but now the pages acts as intended. I do obtain the necessary structure by using parent pages. And 404 error is shown if the url is not correctly typed in. Anyhow, its kinda late on my side of the planet right now. I'll double check tomorrow and leave an update.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.