WordPress.org

Ready to get started?Download WordPress

Forums

create 'fake / virtual page' (like a page being in a folder), shows in url (6 posts)

  1. enthusiasm
    Member
    Posted 1 year ago #

    Hi,

    With a hand-coded site I sometimes place pages in sub-folders of the root, not big news. Those folders are of course not actually a page and only contain the pages served from there. The folder shows in the url and I want to do that in WordPress. Call it a virtual page or whatever.

    here's a page where that appears to occur... http://lakeoswegoattorney.com/team-view/alan-smith/

    If you baskspace through the url removing the persons name you get http://lakeoswegoattorney.com/team-view

    I do know that within Settings > Permalinks > Common Settings it is set to /%category%/%postname%/ as a Custom Structure. That's all I know.

    Thanks for the help to come.

  2. Pyrate.Ned
    Member
    Posted 1 year ago #

    Yeah just make a new top level page named "team-view" then make some pages which have the top level page as the parent. http://lakeoswegoattorney.com/top-level-page-name/child-page/

  3. enthusiasm
    Member
    Posted 1 year ago #

    Thanks and that makes perfect sense unfortunately I do not have, nor do I want, content at http://example.com/top-level-page-name

    I really only want /top-level-page-name to be in the url like a folder holding pages in a hand-coded site.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    Use categories and set your permalinks to be /category/post-name perhaps?

    Or do you specifically need this with pages? I can't quite tell (categories don't work with pages by default)

  5. enthusiasm
    Member
    Posted 1 year ago #

    Or do you specifically need this with pages? I can't quite tell (categories don't work with pages by default)

    The intent was to always use pages. Sorry I can't help you help me.

  6. Pyrate.Ned
    Member
    Posted 1 year ago #

    You do not really need content on http://example.com/top-level-page-name it can just be blank. You could even have a redirect on that page so other people can not access or see it.
    add this to your header.php

    <?php if($post->ID==ID-NUMBER-OF-top-level-page-name){
    header( 'Location: http://example.com/top-level-page-name/child-page/' ) ;
    }

    And because php is server side no one will ever know or see the redirect

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.