Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

<?php
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

2 Answers 2

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

Edit:

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:

<?php
/*
Template Name: Result Template
*/
get_header(); 
?>

//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

 
discard

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.