Today i am going to let you know some useful tricks over wordpress customization. Sometimes a custom PHP file is required in the root folder on WordPress.But we have to develop full functionality for easy format. Creating a separate database connection enhances coding.The simplest way for this is to code according to our needs and access the features of WordPress.

For any custom features of WordPress you should pay attention to the flowchart that how it indexes.For us, the index file is very important in any PHP project that calls your WordPress.

Let's see how to access WordPress function on custom file

include('../../wp-blog-header.php');

Above given file will allow you to give all wordpress access on custom PHP file, You may indicate your file location and can include this function. For database you just simply assign $wpdb->base_prefix. This will allow you to prefix of you database tables, And same as like wordpress you can use
$wp->db.

For example if you are going to list all post over custom php file or you wanted to create own sitemap which will be update as per your cronjob.
This query will give you all post on custom file.

$urls = $wpdb->get_results("SELECT guid FROM $wpdb->posts WHERE post_type='post'");

You may try this simple module you can customize everything as per your need. If you wanted an automated updated sitemap then you may check below article.

How to create an dynamic sitemap for wordpress sites? Do your own seo.