Adding new PHP pages to a template
-
I am curious to if it is possible somehow to add new PHP files to the template directory and allow them to access the stored values and functions that are already in wordpress.
For example, I added a contact.php and biography.php to my current theme’s directory. They show up in dashboard when I log in and view the current theme I made, however, using functions like the_category(), single_cat_title(), the_content(), etc will result in an error.
My main concern is that I want to add a search bar to every new custom page I create. In my contact.php, I added the same code used to add a search bar to my main index page. I use the following code and get the following error.
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
Fatal error: Call to undefined function bloginfo() in themediawiz.com/html/wordpress/wp-content/themes/tmw/searchform.php on line 1
That is the right directory for the file, however, like I said, the new php file can’t read any of the previous functions created. Can anyone tell me what files I need to include in order to make these functions work correctly?
- The topic ‘Adding new PHP pages to a template’ is closed to new replies.