WordPressユーザーのbaserCMS覚え書き


title タグの文字列を取得する

WordPress

wp_title() や get_bloginfo( 'name' ) などの組み合わせ

テンプレートタグ/wp title - WordPress Codex 日本語版
テンプレートタグ/get bloginfo - WordPress Codex 日本語版

baserCMS(2系)

$bcBaser->getTitle( [$separator], [$categoryTitleOn] )

[getTitle] タイトルタグを取得する|baserCMS 2系関数リファレンス

baserCMS(3系)

$this->BcBaser->getTitle( [$separator], [$categoryTitleOn] )

[getTitle] タイトルタグを取得する|baserCMS 3系関数リファレンス

メモ

$this->BcBaser->title() と違い title タグで挟まれる文字列のみを取得するので、ページタイトルとして使うときは

<title><?php echo $this->BcBaser->getTitle() ?></title>

のようなかたちでマークアップする必要があります。

WordPressでは wp_title() の第2引数に false を与えれば、$bcBaser->getTitle() のように「取得系命令」として機能させることができます。