• Resolved Sykat

    (@sykat)


    My goal is simple, I want to print a mp3 song’s metadata using getid3 (I handled that) in an independent php file named download.php (located in wp root) . I want to show that page’s content within my wp blog’s header and footer and in same theme. So, How can I load the theme, header and footer? (I am just a starter)
    I am expecting something like:

    <?php include 'header.php';
    My bla bla content goes here
    include 'footer.php'; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • So you want to create a custom WordPress page on which you would list the mp3s info and use download.php as its template file? If yes, each WP template file must consists of mandatory comment

    <?php
    /*
    Template Name: My Custom Page
    */

    which WP parses and you can then select this file as the post’s template file. To include header and footer, you simply call get_header() and get_footer() in that file anywhere you like to.

    To learn more about custom WP templates read about it on Page Templates.

    Thread Starter Sykat

    (@sykat)

    I got it half hours ago. All I need to pest bellow code in any external php file to load header and footer:

    <?php
    include 'wp-load.php'; //wp file path include
    get_header(); //load header
    ?>
    My content, html and codes here bla bla
    <?phpa
    get_footer();  //load footer
    ?>

    P.S: Someone moderator here to tag it as resolved and close this thread?

    While your approach works, you could have simply created a new template file in your theme directory with the needed code and assign that template to a specific page in your WP admin panel. That would be a more WordPress-like way of doing things (instead of loading the whole WordPress in a custom way by calling wp-load.php)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Including wp header and footer (and all plugin effect) in custom php file?’ is closed to new replies.