WordPress.org

Ready to get started?Download WordPress

Forums

Custom Page Template with Personalized URL (4 posts)

  1. jrm213
    Member
    Posted 4 years ago #

    Hi,

    I was wondering how I would do something like this. I want to let my users create their own little content page to list stuff they want. I am storing the stuff they want in a database table, and I made a page called items that goes to the database and displays a specific persons data by their ID.
    The url is currently like http://www.mysite.com/items/?id=99
    I would like the user to enter be http://www.mysite.com/items/johndoe but the items page needs to receive the id as 99.

    I feel like this should be possible using .htaccess but am not sure how to configure it because I currently have the permalink structure already rewriting the url.

    Thanks for any help provided.

  2. hikerjoe
    Member
    Posted 4 years ago #

    I am trying to do the same thing, but have not found a solution anywhere, yet.

    I know it's possible because the Pods CMS plug-in seems to accomplish it. With Pods, you can define your own data types and have them understood by the permalink structure, just like in jrm213's example above... but I haven't been able to decipher how Pods does it and for my own reasons I need to do this without Pods.

    Hoping someone else can help explain how we might add custom data types to the WordPress permalink structure.

  3. hikerjoe
    Member
    Posted 4 years ago #

    This has been a difficult nut to crack, but after a lot more searching a bit of good luck, I figured it out.

    The solution was to the modify the query rules WordPress uses internally to handle custom queries when sent as "friendly" URLs (or "Permalinks") by way of the $wp_rewrite function.

    The answer that worked for me can be found in the WordPress Codex document entitled Custom Queries right at the bottom under the heading "Permalinks for Custom Archives." I just took the example in that article, added it to my plug-in script, and it worked.

    I guess I just didn't know what terminology to search on when trying to figure this out.

  4. mthomas9
    Member
    Posted 3 years ago #

    Just release a Personal URL WordPress Plugin that you might find helpful for this:

Topic Closed

This topic has been closed to new replies.

About this Topic