Wordpressのウィジェットの説明の中に改行を追加して、管理パネルに次のような使用方法を表示したいと思います。
To format the text use the tags:
<h3>Subtitle</h3>
<strong>Bold</strong>
[:pt]Text in Portuguese
[:en]Text in English
[:es]Text in Spanish
これまでのアイデアは、ISO 8859-1記号(
)を使用してスペースを追加することですが、これは最善の解決策ではありません(説明はポルトガル語です)。
register_sidebar( array(
'name' => 'Widget',
'id' => 'widget-user',
'description' => "Para formatar o texto, utilize as tags: <h3>Subtítulo laranja</h3> <strong>Negrito</strong> [:pt]Texto em português nbsp; [:en]Texto em inglês [:es]Texto em espanhol (o que estiver escrito fora das tags de idioma irão aparecer para todos",
'before_widget' => '<div class="widget-user"><div class="box">',
'after_widget' => '</div></div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
itens'before_widget'、'after_widget'、'before_title'、および'after_title'とは異なり、'description'はHTMLを受け入れません。もしそうなら、私がHTMLに変換したくないHTMLをエスケープするだけで簡単に解決できますhtmlspecialchars()
。
私は必死にこれらを試しましたが成功しませんでした:
"description" => "This is a line <br> break test"
"description" => "This is a line \n break test"
"description" => "This is a line \r break test"
"description" => "This is a line \r\n break test"
"description" => htmlspecialchars("This is a line <br>break test")
htmlspecialchars("description") => "This is a line <br>break test"
"description" => htmlentities("This is a line <br>break test")
"description" => html_entity_decode("This is a line <br>break test")
"description" => nl2br("This is a line <br> break test")
nl2br("description") => nl2br("This is a line <br> break test")
それで、何かアイデアはありますか?