1

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.

1

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.

| improve this answer | |
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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