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”] 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

I Built a Consulting Firm’s Website on WordPress.com in One Sitting

A new consulting firm called DIG3 handed me a logo, a one-paragraph…

How to Manually Migrate a WordPress Site from ScalaHosting to WordPress.com

There is a point in every self-hosted WordPress journey when managing the…

What’s New In WordPress 4.3

  WordPress is the most widely used content management system in the world. It is an excellent platform for beginners to launch their blog without needing expert knowledge on HTML. WordPress is also useful for sole proprietors who want their business to have an online presence but at the same time do not want to […]

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 ) && array_key_exists( $tag->term_id, $category_images […]