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

Use the RSS feed for a specific category

If you want to encourage your readers to subscribe to some of the updates of your site, it may be interesting to set up RSS feeds by category. The feed url to track updates on a category is obtained very simply by getting the URL of your category and add this /feed after the link they […]

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 […]

WordPress Hack: remove “WordPress Generator”

The publishing platform WordPress adds a small line for itself to advertise and clarify that the site that you find is a site using WordPress. Except that in addition to reporting that it’s WordPress, it goes to show the current version.It is not embarrassing, except that each version has its security problems… Past one of […]

WordPress.com got a new face and open-sourced

Automattic, the creator of WordPress announced today, the relaunch WordPress.com. WordPress.com is the sister solution of the content management system WordPress, but it’s considered as the money-making machine for the company because it’s a hosted version of the CMS used by up to 25 percent of the Web entities. Based on the same system in […]