Saturday, December 21, 2024

Create a custom PHP page in the WordPress environment

- Advertisement -spot_img
- Advertisement -Best Managed Hosting

How to create a custom PHP page that have access to all variables and functions within the environment of our WordPress blog? The answer is very simple.

wordpress-blue-xl

First create a page in your theme folder:

/wp-content/themes/your-theme-name/page.php

- Advertisement -
Best Managed Hosting

After that use this code in the top of your page

[sourcecode language=”php”]<?php
define(‘WP_USE_THEMES’, false);
require(‘../../../wp-blog-header.php’);
?>[/sourcecode]

Now you can easly  use all the functions specific to WordPress (primarily the loop) in your custom page.

- Advertisement -
Latest news
- Advertisement -



Liquid Web Storm VPS
Related articles
- Advertisement - Traffic Analysts Tool