Sunday 21 July 2013

Site and WordPress installation Web address

 

As we discuss in Book VI, one of the most common template tags for use in
a theme is the bloginfo(); tag, which has several parameters you can use
to call different bits of information about your site (like the site name and
description, for example). You then can call in different theme template files
and graphics (or images) into your theme. For example, the URL of your Web
site can be defined in your template files with the following template tag:

 

<?php bloginfo(‘url’); ?> // Site URL

 

In Book VI, we cover template tags and parameters in detail.

 

That template tag tells WordPress to communicate with the site database,
locate the site URL, and return it back to the template or plugin file that’s
making that database call. You can greatly reduce the number of database calls
(thereby, speeding up your site) by defining the site URL in the wp-config.
php file by inserting the following two lines on their own lines (replacing
yourdomain.com with your actual domain name, of course):

 

define (‘WP_HOME’, ‘http://yourdomain.com’); // site address

define (‘WP_SITEURL’, ‘http://yourdomain.com’); // wordpress address

 

With these two lines in place in the wp-config.php file, whenever

WordPress comes across a template tag that requests your site URL, it won’t
need to reach out to your database to discover what that URL is because it’s
defined in the file structure within the wp-config.php file. This reduces
the number of calls to the database, which, in turn, reduces the resources
your site uses on the Web server to display your Web site to your visitors.

 

0 comments:

Post a Comment