WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using twenty eleven for my theme and I create a PHP page under it named results.php in the results.php here's my code:

get_header(); ?>
<?php get_footer(); ?>

From my index.php:

get_header(); ?>
<a href="wp-content/themes/twentyeleven/result.php">Main</a>
<?php get_footer(); ?>
share|improve this question
How do you call the custom PHP file? Directly? As a template? – toscho Oct 6 '12 at 11:59

You get undefined function because you are pointing to the result.php directly. That way WordPress just doesn't load.

If you need to include result.php in a specific place use get_template_part or even better locate_template

share|improve this answer

There is no opening <?php tag in your second (index.php) block of code.

It should look like,

<?php get_header(); ?>
<a href="wp-content/themes/twentyeleven/result.php">Main</a>
<?php get_footer(); ?>

Ammend that and try again


I didn't read that clearly the first time around but you need to link to your Result page like this,

<a href="<?php get_the_permalink();?>/result/">Main</a>

At the top of result.php, change it to read:

Template Name: Result Template

//do your results stuff here... or get regular page loop.

<?php get_footer(); ?>

In your dashboard, go to Pages, Add New and enter a Title named Result.

Then from the right hand side Page Attributes meta box, select your Result Template from the drop down menu and then Publish the page.

When you visit http://www.yoursite.com/result/ your page and its content will show correctly using the result.php page template created and assigned.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.