Why WORDPRESS is better?

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

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.


You May Also Like

Backing Up WordPress – Be Secure

Every user of WordPress knows that there is always a need to back up their files and database. This is because the security level of the WordPress is not be strong enough and that your site might get hacked. If your site will get hacked, surely your files and databases will be gone. So as […]

Why WordPress is the ultimate option for Non-techy business owners

In this digital age, every business needs an online presence. This can become an issue for business owners especially who have a limited budget and cannot afford to hire a digital agency or a web developer. Small business owners take up on this task on their own even if they do not possess the required […]

Affect an image to categories in WordPress without plugin

This tutorial allows you to add a text field to fill the URL of an image for each of your categories. Add this in your functions.php file: [sourcecode language=”php”]add_action(‘init’, ‘my_category_module’);[/sourcecode] [sourcecode language=”php”]function my_category_module() { add_action ( ‘edit_category_form_fields’, ‘add_image_cat’); add_action ( ‘edited_category’, ‘save_image’); }[/sourcecode] The function to add the extra field : [sourcecode language=”php”]function add_image_cat($tag){ $category_images = get_option( ‘category_images’ ); $category_image = ”; if ( is_array( $category_images ) &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; array_key_exists( $tag-&amp;amp;amp;amp;gt;term_id, $category_images […]

Save more WordPress’ database disk space with a simple trick

If you use WordPress as blogging platform, and you have installed a recent version, you must have see that it has become more greedy in space. This is particularly due to the registration of “revisions”. What is “revisions”? These are versions of posts that are recorded as you write. This is a very useful feature […]