Support » Fixing WordPress » How to include new PHP page?

  • I’d like to add a download.php page to my blog. It will be used to track various downloads (MP3, EXE, etc) via javascript in the page. I have the page up but it is basically a blank page with the download link. It works fine now and tracks downloads but I want the blog shell wrapped around this page so it looks like part of the blog. I tried to include some of the code from category.php but got reference errors because download.php couldn’t find the functions I copied over from category.php.

    When I reference download.php, it is a direct reference such as Should I reference it a different way to get the blog shell to display?

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is totally off the top of my head, but you may want to put it in the theme folder with the header.php, category.php, etc. so everything is on the same directory level.

    What would that reference look like? I tried:

    and that just displays the same blank page. Then I added in the code I had used from category.php. That gives an error because get_header() isn’t recognized. I’m guessing the file needs to be referenced a certain way.

    I’m not sure that I totally follow you with the download stuff, but as far as “wrapping the blog shell around it”, you can just take the “Main Index Template” code (or “index.php”, or whatever it may be called in a particular theme), copy it, save it as “download.php” and then put your javascript, etc. in the “main” div, keeping the PHP that wordpress uses to get the header, footer, sidebar, etc. Kinda like this:

    <?php get_header(); ?>
    <div id="main">
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Beyond that, maybe someone else can help with the references and such for the download tracking.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to include new PHP page?’ is closed to new replies.