Sunday, September 19, 2021

Create a custom PHP page in the WordPress environment

- Advertisement -spot_img
- Advertisement -Traffic Analysts Tool

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 -Traffic Analysts Tool

After that use this code in the top of your page

<?php
define('WP_USE_THEMES', false);
require('../../../wp-blog-header.php');
?>

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

- Advertisement -Traffic Analysts Tool
- Advertisement -Traffic Analysts Tool
- Advertisement -
Hamza Mikouhttp://www.mikou.net
The owner of www.blogprocess.com and many other blogs. He started making money from the internet 12+ years ago. And BlogProcess is his way to giveback and show people how to do the same. Find more about him at:
Latest news
- Advertisement -



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