1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

(ドラフト)WordPressのソフトウェア構造等を見てみる

Last updated at Posted at 2020-05-07

1.はじめに

WordPressは、世界で1/3のサイトが使っているWebサイトのコンテンツ管理ソフト(CMS)で有力なソフトである。WordPressを操作する必要が発生したので、ちょっと調べてみる。
ふと見ると、WordPressの解説本を読んだほうが、まとまっていて良い気もする。

入門資料

2.各種情報

2.1.運用者向け資料

バックアップ

データベースとwp-content配下のコード

WordPress権限

WordPressのルーティング処理

記事のURL指定の話である。いわゆるMVC構成をとるWebアプリケーションフレームワークでのルーティング処理に該当する設定ファイルは無い。単に、該当URLに相当するページをDBから検索して表示する機能(Rewrite API)があるだけである。

参考資料

サブドメインでのサーバの上げ方

2.2.開発者向け資料

ディレクトリ構造

.
└──public_html
    ├── robots.txt     (検索エンジン向けアクセス拒否ファイル)
    ├── sitemap.xml    (検索エンジン向け構造提示ファイル)
    ├── wp-config.php  (WordPress設定ファイル)
    ├── index.php      (HTTPDサーバから、一番はじめに呼び出されるスクリプト)
    ├── wp-content
    |    ├── themes
    |    |    └── twentyfifteen
    |    └── plugins
    |         ├── gutenberg      (原稿編集エディタ WordPress5より)
    |         └── contact-forms7 (問合せフォームなど)
    └── documents

参考資料

コード量

WordPressは、PHPだけでも236K(23万行)あるので、全部見るのはちと重い。

github.com/AlDanial/cloc v 1.82  T=10.85 s (170.2 files/s, 89892.4 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment          code
-------------------------------------------------------------------------------
JavaScript                     482          52821          75802         247065
PHP                           1000          47331         140851         236130
CSS                            290          23605           7654         130775
Sass                            54           1218             65           5002
JSON                             3              0              0           4554
SVG                             12              0              6           1585
Markdown                         3            130              0            243
HTML                             1             13              0             85
XML                              1              6              0             37
-------------------------------------------------------------------------------
SUM:                          1846         125124         224378         625476
-------------------------------------------------------------------------------

WordPress/wp-content以下は、16K(1万6千行)なので、何とか面倒見れる範囲である。

github.com/AlDanial/cloc v 1.82  T=0.62 s (665.6 files/s, 174005.2 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
CSS                             64           9185           3987          51926
PHP                            260           3258           7592          16829
JSON                             2              0              0           4491
Sass                            44           1059             60           4456
JavaScript                      37            586            723           2580
SVG                              6              0              6           1386
Markdown                         2            129              0            241
-------------------------------------------------------------------------------
SUM:                           415          14217          12368          81909
-------------------------------------------------------------------------------

WordPressのデータベース

Codexにテーブルとその編集画面が記載されている。ここでは、主なテーブルを以下に示す。なお、WordPressのWebUIで編集できるものは別途示す。

テーブル名 概要 WebUIでの編集
wp_terms カテゴリ名称 カテゴリーで編集
wp_terms_taxonomy カテゴリの説明文など カテゴリーで編集
wp_posts 投稿記事テーブル 投稿一覧で編集
wp_options WordPressのパラメータ設定 メディアアップロード画面等

参考資料

A.参考資料

コミュニティ

利用例等から

リニューアル

ソフトウェア構成

レイアウトの変更

wp-content/template配下のコードを変更する。

関連知識

B.いろいろ

(調査中)ファイルアップロード

ファイルのURLを指定したい。(post_contentを編集する必要がある?)
デフォルトパスはwp-content/uploadsである。upload_pathに、パラメータを設定することにより変更できる。そして、外部から見えるURLは、post_contentに記録される。なお、ファイルのURLの一部をなすupload_pathは、wp_optionsテーブルで設定している。

(検討)検索機能追加

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?