WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Non-wp PHP pages using wp theme etc (5 posts)

  1. planetthoughtful
    Member
    Posted 8 years ago #

    Hi All,

    I'd like to create some PHP pages to go with my WP site that require functionality not provided by WP.

    I'd like these pages to have the same look and feel as my WP pages (ie use the same theme and layout etc) and I'm wondering if there are WP functions you can include from somewhere that allow you to do the same things as include your theme's sidebar, CSS and so on in a page that isn't part of the WP package?

    Any help immensely appreciated!

    Much warmth,

    planetthoughtful

  2. MichaelH
    Member
    Posted 8 years ago #

  3. Beel
    Member
    Posted 8 years ago #

    <?php
    define('WP_USE_THEMES', true);
    require('./path-to-your-blog/wp-blog-header.php');
    ?>

    http://www.google.com/search?hl=en&lr=&q=site:wordpress.org+include+wp+in+other+pages&btnG=Search

  4. planetthoughtful
    Member
    Posted 8 years ago #

    @MichaelH

    Thanks, I should have said that I was already aware of these plugins. As with many professional PHP developers, I have an aversion to using eval() to execute code; probably more of an aversion than I really need to have, but still.

    @Beel

    Thanks for the tip, and for the Google link. I'll take a look at them and see how I go.

    For what it's worth, I've actually made some headway since I posted this topic with using custom WP page templates. I may have missed the point while reading the Codex, but it wasn't obvious to me that you can use WP pages based on custom templates that will be interpreted dynamically from the template when called, rather than statically from the WP page.

    So, my current solution, which seems to be working, is to create a 'template' called feedbackform.php in my theme directory, with all of the funcationality built in that I need as well as having the site's theme / css available, then create a page in WP based on that template, and use the page_id / slug to execute the code in the custom template.

    While this process is described on the Codex in Creative a Search Page, it didn't stand out as being the answer I was looking for when I first read through it. A second read, and some experimentation, has proven otherwise.

    I'll still go through the links you provided, Beel, since it seems these might offer me even more development freedom than the solution above.

    Thanks to both!

    Much warmth,

    planetthoughtful

  5. dubsix
    Member
    Posted 8 years ago #

    I recently came across this plugin

    http://redalt.com/wiki/EzStatic

    which might also be what you're after.

    cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags