Forums

Custom Post Type - Sub URL's (2 posts)

  1. projectfuturism
    Member
    Posted 1 year ago #

    Hey guys,

    Let's say I have a Custom Post Type, but want to display it over a few pages rather than one page.

    It's kind of like a user profile.

    So let me explain in URL terms.

    I want it to be:

    Main Profile Page
    http://www.example.com/profile123/

    Images Page
    http://www.example.com/profile123/images/

    Contact
    http://www.example.com/profile123/contact/

    Now, I know you can do custom taxonomys, but thats the reverse, ie the 'profile123' parent rather than child.

    As you can see, it'd be a wise thing for them all to be lumped into the one profile, rather than 3 different 'pages/posts' in the database.

    How would I go about this???

    Thanks.

  2. projectfuturism
    Member
    Posted 1 year ago #

    OK, so I solved it using the $_GET function.

    <?php
    
    $page_display = $_GET["c"];
    
    if ($page_display == showcase) {
        require('profile_showcase.php');
    } elseif ($page_display == reviews) {
        require('profile_reviews.php');
    } elseif ($page_display == directions) {
        require('profile_directions.php');
    } elseif ($page_display == contact) {
        require('profile_contact.php');
    } else {
        require('profile_about.php');
    }
    ?>

    It does the trick, but does have a few drawbacks which I am working on.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags