ThemeShaper Forums » Thematic

[closed]

Question about creating page templates

(6 posts)
  • Started 13 years ago by BJC
  • Latest reply from BJC
  • This topic is not resolved
  1. BJC
    Member

    Hello,

    I have created a template in my child theme using the page.php layout. The difference for this page compared to the rest of the pages will be minimal. It will contain a search engine that is called via a php include.

    When I view the new page in my browser using the permalink, it works perfectly fine. However, when I try to access the page directly via the url [http://casiopa.mediamouse.ca/wp-content/themes/casiopa/searchresults.php], I get a php error ]Fatal error: Call to undefined function get_header()]. The problem is that I need to call the page using the url and not the permalink for the search engine to work. This page is located in the same file as my style.css and functions.php pages.

    Wondering if anybody can be of any assistance. php is something I'm new at and I'm wondering if this has something to do with file paths in the template file. I have tried working on this, but can't seem to get past the error.

    Thanks

    Posted 13 years ago #
  2. post your template code and we'll take a look

    Posted 13 years ago #
  3. BJC
    Member

    The url for the search page is the following: http://casiopa.mediamouse.ca/advancedsearch/

    However, the issue is that I need to link to the page using the full url via the "Advanced Search" link which is the following: http://casiopa.mediamouse.ca/wp-content/themes/casiopa/searchresults.php

    The search engine needs the full url in order to work correctly. I have been able to get the search engine to work within the site by directly copying and pasting the code into a page called "searchresults.php". This isn't ideal since the idea is that the client will want to update the site and in doing so, this page won't be updated.

    I guess the question I have is whether it's possible to create a page that calls php includes (header, footer, sidebar) and resides in the same folder as the style.css and functions.php.

    Posted 13 years ago #
  4. I'm not exactly sure what you are asking- but perhaps you just need to define the template paths: http://wptheming.com/2010/06/wordpress-directory-paths/

    Posted 13 years ago #
  5. Me thinks Devin is right. This sounds like a page that is looking for something it can't find. Could you post the code you are using to call the search?

    I also think you're better off performing the include into functions.php, then applying the necessary search code html to your page template via an action hook within functions.php as well. It'll keep things cleaner, more future-proof, and help diagnose things when they break by having one central file to blame when things go bad.

    Posted 13 years ago #
  6. BJC
    Member

    I'm trying to figure this out using the link provided above and will post my solution if I do. I agree that using the functions.php is ideal, but I'm not sure if my php skills are advanced enough to do so. I can't imagine that calling includes is too complicated.

    Posted 13 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.