address and path

Site and WordPress installation Web address

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

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.

Template and stylesheet path

Just as with the site URL from the preceding section, many themes and
the WordPress core code look for your WordPress theme template and
stylesheet directory through the following WordPress template tags:

<?php bloginfo(‘template_directory’); ?> // template directory
<?php bloginfo(‘stylesheet_directory’); ?> // stylesheet directory

Once again, you can significantly reduce the number of calls to the database
for the template and stylesheet directories by directly defining them in your
wp-config.php file. To do so, add these two lines of code (replace absolute/
path/ with your own server path and replace /themefolder with the name
of the theme folder you use currently) on their own separate lines:

define(‘TEMPLATEPATH’, ‘/absolute/path/to/wp-content/themes/themefolder’);
define(‘STYLESHEETPATH, ‘/absolute/path/to/wp-content/themes/themefolder’);

As with the site URL in the preceding section, having these two lines of code
in your wp-config.php file defines the file path within the file structure
in the wp-config.php file, so that WordPress doesn’t need to make an
additional call to the database to discover what the absolute and stylesheet
paths are

address and path

Leave a comment