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 want to create a custom page for my Wordpress blog that will execute my php code in it, whilst remaining a part of the overall site css/theme/design.

The php code will make use of 3rd party APIs (so I need to include other php files)

How do I accomplish this?

N.B. I do not have a specific need to interact with the Wordpress API - apart from including certain other php libs I need I have no other dependencies in the PHP code I want to include in a WP page. So obviously any solution that didn't require learning the WP api would be the best one.please help me to slove this problem.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Please refer to the Page Templates section of the Static Pages Codex entry.

Essentially, you create a custom page template, named something like template-foobar.php, which will live in your Theme's root directory, or in a one-deep sub-directory.

Inside this template file, add the following:

<?php
/**
 * Template Name: Foobar
 */

get_header();

// YOUR CUSTOM PHP GOES HERE

get_footer();
?>

Now your template is available to be assigned to any static Page you create.

share|improve this answer

Create a custom page template, and add your code there. There is also an older article by Justin Tadlock about that topic.

Basically, you copy the page.php or single.php of your theme, add a header to it …

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

… and your code.
In the back-end you select that template for the page you want to create.

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.