• I’m writing a plugin which requires a special webpage. I would like it to be accessible via some friendly URL, like http://myblog/do-something/. How do I set it up?

    The way I’m doing it now is
    a) creating a category “do-something”
    b) creating a template file category-XXX.php (where XXX is the ID of the category I create)
    c) enter the HTML & PHP code that calls the plugin and does what it is supposed to do in this new file.

    I know it’s a dirty hack and there must be a way to do it nicely, but I could not find any valuable hints how to do so in the online help pages about templates.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I recently noticed this plugin: http://txfx.net/code/wordpress/page-links-to/ which allows a WP page to redirect to any other page. Might be what you’re after.

    I’ve found my ‘favorite’ approach is to use a Page Template, as then the user can name the page anything they want — and if there was other ‘user content’ to show, they could add it into the page content, and the plugin/page-template can do with it what they will.

    Otherwise sounds similar to your approach.

    Thread Starter michuk

    (@michuk)

    Yesm using a page template an “runphp” plugin works well, too. This is probably the best way to do it, though I still think it’s a hack 🙂

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The best way to do it is to use the WP-Rewrite stuff and create your own rewrite rule inside wordpress. This way you can take a specific name.

    Examine the UTW plugin. It uses this method to take the name “tag”, so that blog.com/tag/whatever will get intercepted by UTW.

    Thread Starter michuk

    (@michuk)

    Thanks Otto for your hint. UTW is an interesting plugin and I may use it in other ways as well, actually.

    I’m marking this topic as “resolved” since I got what I wanted. Thanks again for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add a new PHP file accessible via a friendly URL?’ is closed to new replies.