> For the complete documentation index, see [llms.txt](https://super-yusuke.gitbook.io/wordpress-memo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://super-yusuke.gitbook.io/wordpress-memo/yokuu.md).

# よく使う関数

### get\_search\_form() searchform.php を呼び出す

おそらく、wordpress に最初から組み込まれている関数。呼び出すファイル名も、これで固定。 変更してはダメなはず。

### body\_class(); ページによって(home, category 等)によってクラス名をつけてくれる

これを元に CSS をカスタマイズをすると楽。

### is\_single(); シングルページの場合は

他にもいろいろある。

### wp\_title( '::', true, 'right' );

タイトルを、区切り文字 :: で、表示する、区切り文字は右側。

### CSS 等へのパスを動的に正しく伝える

```php
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/images/favicon.ico" />
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" media="screen" />
```

```php
echo get_template_directory_uri()
```

でテンプレートのディレクトリまでのパスが取れる。
