• Resolved psychomachine

    (@psychomachine)


    Hi,

    I’ve been working on a web app (PHP, MYSQL). now i am trying to integrate it with wp. the idea is simple: wp in root directory, application as a subdirectory of the root directory.

    https://www.website.com –> WP
    https://www.website.com/app/ –> webapp served rom root/app subdirectory

    i’d like the webapp’s output to be placed in the main content of the page (where normally you’d see posts), but i’d still want WP to be responsible for header, sidebar and footer, as it is in regular wp posts.

    could somebody give me a hint or two how to achieve this? would this be the stuff for a plugin? or just a matter of redirects? i don’t know where to start. my web app is fully functioning, but i don’t know how to start building the bridge to wp.

    all best,
    tench

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Use a Page Template.

    https://codex.www.ads-software.com/Pages#Creating_your_own_Page_Templates

    Basically you’re going to make a new PHP file in your WordPress theme. It’s going to start like this:

    <?php
    /*
    Template Name: Whatever you want
    */
    ?>

    Then you’re going to make a new Page in WordPress (using Write->Write Page). This page will use this Template (look on the right hand side of the page and choose your template). Set the slug for this page to “app”, thus giving you the example.com/app/ URL. Your app won’t actually be inside the “app” subdirectory anymore, you’ll have to move it somewhere.

    Finally, your Page Template will be custom coded to call your application. But before it does that, it’ll call get_header(), get_sidebar(), and finally get_footer() to display those things. Other than that, it can run any PHP code you like.

    That’s not the only way to do it, but it is perhaps the simplest and most easily customizable to fit into the site properly.

    Other possible ways:
    – Write a plugin that catches the “app” name and redirects it.
    – Make your app include the wp-blog-header.php file and then call the header/sidebar/footer functions from the app itself.

    Thread Starter psychomachine

    (@psychomachine)

    dear otto,

    many thanks for your reply — that’s exactly what i needed.

    all best,
    tench

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘integrated existing web app into wp (not the other way around)’ is closed to new replies.