WordPress.org

Ready to get started?Download WordPress

Forums

Add page to public side of WordPress (2 posts)

  1. BrandonD
    Member
    Posted 1 year ago #

    Hi guys,

    I am developing a custom WordPress plugin for a site. The basic goal of the plugin is a gallery of sorts with user uploads. There's quite a bit more to it than that obviously but that should paint the picture good enough.

    I already have the administrator side complete. I am now looking at the best way to do the front end. My plugin will have a 'homepage' and hundreds of different gallery pages with hundreds of thousands of files. Example URLs of these pages:

    /content
    /content/wallpapers
    /content/wallpapers/additional/filters
    /content/wallpapers/name-of-user-upload-145667

    What is the best way to get WP to not 404 these URLs and instead pass them off to my plugin? Additionally, what would be the best way to compile these pages output, keeping in mind I still want to utilize the theme's header, footer, and general layout of course.

    Thanks!

  2. bcworkz
    Member
    Posted 1 year ago #

    To utilize such urls, use the Rewrite API. My approach would be user galleries would be essentially posts, so you can use the existing tag and category tools. All the images would be attachments, thus everything is in the database. Then you can use the url elements you get via the rewrite API to construct queries to return the appropriate content.

    Be sure you sanitize all the url elements before you use them in queries.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.