0
こんにちはstackoverflow、WordPress twenty12、wp_titleから最初の2単語を出力するには?
wp_titleを使用してページのタイトルを出力していますが、タイトルが長すぎます。
誰も私のタイトルの最初の2単語だけを返す関数を書く方法を説明することはできますか?
Img exemple:ありがとうございます。
<?php wp_title(''); ?>
こんにちはstackoverflow、WordPress twenty12、wp_titleから最初の2単語を出力するには?
wp_titleを使用してページのタイトルを出力していますが、タイトルが長すぎます。
誰も私のタイトルの最初の2単語だけを返す関数を書く方法を説明することはできますか?
Img exemple:ありがとうございます。
<?php wp_title(''); ?>
//use this code in functions.php file
add_filter('wp_title', set_page_title($message));
function set_page_title($message) {
$message = explode(' ', $message, 2);
$message = implode(' ', $message);
//Here I can echo the result and see that it's actually triggered
return $message;
}
それ文句を言わない仕事である、と私はカントーありがとう、私はSUBSTRを使用する必要が信じて –