1
votes

I'm trying to add custom template to my Wordpress theme, which would be static "About" page template. I create about.php file in my twentytwelve folder and put inside content like:

<?php get_header(); ?>

blah blah page content

<?php get_footer(); ?> 

When I open this file in browser, I get error "Fatal error: Call to undefined function get_header() in *site_folder_name*\wp-content\themes\twentytwelve\about.php on line 2".

How can I fix this issue?

2
do it the proper way? Wordpress doesnt know about your file, therefore there are no require statements, and therefore your php doesnt know those functions - Soundz
You don't want to open the file in the browser directly, you still want to go through Wordpress to open the resource. - Pekka
So, how can I make wordpress recognize my page? - user2713518

2 Answers

1
votes

I think you should start from the very minimum wordpress template so that you get the hang of it.

There is a very good tutorial available on this:

http://www.siteground.com/tutorials/wordpress/wordpress_create_theme.htm

The problem you are experiencing, I think, is because you are working by editting an existing template with all of it's own additional code.

1
votes

First Add a tamplate name in top of your page code:

<?php
/* 
 * Template Name: About Page
 */

And so in the wordpress dashboard: pages -> your page -> click on quick edit and choose About Page template as your page template.

Read more about Page Templates in wordpress codex: http://codex.wordpress.org/Page_Templates