How to shape up WordPress - Takeopiv

How to shape up WordPress

Shelf
このブログ”たけログ”はWordPressで作られています。 サイトには静的(Static)サイトと動的(Dynamic)サイトがあります。 ブログやEコマースサイトなど、記事やコンテンツをデータベースとして管理し、ユーザーのアクセスに動的に対応して、毎回HTMLファイルを生成するのが動的サイトです。 動的なアクションをするためには、サーバーのCPUを使う事になりますが、複雑なものやページヴューの多いサイトは、CPUに大いに負担となるようです。
昨日あたりに、このブログを覗いていただいた方は、ご存知かと思いますが、ページが表示されていませんでした。(ご迷惑かけました) サーバー会社から、「CPUに負担をかけすぎている」というクレームが来て、強制的にアクセス制限がかけられていました。
この5月に、3年間分のブログをWordPressに移植して、再スタートしました。 本当によいソフトで気に入っています。
WordPressにはタイトルやキャッチフレーズなど頻繁に使う言葉などを、テンプレートとして管理し、出力ファイルに埋め込んでいきます。 テンプレートタグの処理はすべてCPUサイドが負担します。 もしかしたら、シェイプアップできるかも? というテンプレートタグがあるようなのでメモしておきます。

1) <?php language_attributes(); ?> found in header.php.

2) <?php bloginfo(’html_type’); ?> found in header.php.
3) <?php bloginfo(’charset’); ?> found in header.php.
4) <?php bloginfo(’name’); ?> found throughout the theme.
5) <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.

6) <?php bloginfo(’stylesheet_url’); ?> found in header.php.
7) <?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).

8) <?php bloginfo(’pingback_url’); ?> found in header.php.
9) <?php bloginfo(’stylesheet_directory’); ?> found throughout the theme.
10) <?php bloginfo(’description’); ?> found throughout the theme. Your site’s slogan.
11) <?php bloginfo(’comments_rss2_url’); ?> found in sidebar.php and footer.php.

12) <!– <?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!
13) 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() ) : ?>
and
<?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.

Leave a Reply