13 Tags to Delete From your Theme216
Free themes are designed to be as easy to install as possible. You simply upload your theme, activate it, and you’re done. It knows your blog’s name, description, feed URL and everything else.
In order to know all of this, the theme uses PHP tags to get the information. However, it has to use these tags every time a page is loaded.
As most of the information never changes, you can delete these tags from your theme, and replace them with normal text. That way, your server has less to process next time around.
13 Common Tags in WordPress Themes
The easiest way to replace the tags is to load up a page from your blog, then “View Source.” Now go through your theme and look for the following tags, then find what each tag corresponds to in your page source. Paste the text from the page source over the theme tags.
Save the files after every change and check that the new version of the page is identical to the old.
- <?php language_attributes(); ?> found in header.php.
- <?php bloginfo(‘html_type’); ?> found in header.php.
- <?php bloginfo(‘charset’); ?> found in header.php.
- <?php bloginfo(‘name’); ?> found throughout the theme.
- <meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> <!– leave this for stats –> found in header.php. If you’re using a 3rd party stats program (like Google Analytics) then you’ve nothing to worry about, and if your version of WordPress is out of date, you won’t want hackers knowing that.
- <?php bloginfo(‘stylesheet_url’); ?> found in header.php.
- <?php bloginfo(‘rss2_url’); ?> founder in header.php, sidebar.php and footer.php. Be careful if you switch to FeedBurner after doing this. Make sure you remember to update the feed URL here manually (The FeedSmith plugin won’t do it anymore).
- <?php bloginfo(‘pingback_url’); ?> found in header.php.
- <?php bloginfo(‘stylesheet_directory’); ?> found throughout the theme.
- <?php bloginfo(‘description’); ?> found throughout the theme. Your site’s slogan.
- <?php bloginfo(‘comments_rss2_url’); ?> found in sidebar.php and footer.php.
- <!– <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. –> found in footer.php. This HTML comment won’t be overly useful to many of us, so delete away!
- If you are using widgets, you can also delete the code in sidebar.php between the lines<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>
<?php endif; ?>
Content between these 2 lines is only used if widgets are not enabled. If you know that you will continue to use widgets, then there is no need for any code here (It may be worth leaving a comment along the lines of “Content here used if widgets are disabled” to remind yourself of this in the future).
By removing these, you’ll shave the load of your server and pages will be constructed that bit faster.
Enjoy this post? You should follow me on Twitter!