內容簡介
DMG Text Widget 取代了標準的文字小工具,並添加了高級選項,以應用 CSS 類、添加段落、應用短代碼、隱藏標題以及將標題設置為連結。
兩個鉤子可用於篩選標題和文本;標題用dmg_text_widget_title,文本用dmg_text_widget_text。
例如,要在單個頁面或文章中更改標題,您可以將以下內容添加到 functions.php 文件中:
function myTitleFilter( $title )
{
if( is_singular() )
{
return "<strong>$title</strong>";
}
else
{
return $title;
}
}
add_filter( 'dmg_text_widget_title' , 'myTitleFilter');
有關此插件的更多信息,請訪問http://dancoded.com/tag/dmg-text-widget/。
添加 CSS 類
輸入一個或多個字符串(以空格或逗號分隔),將其應用為 CSS 類到小工具包裝器。這些類使用 WordPress 內置的sanitize_html_class()函數進行消毒處理。
使標題成為鏈接
輸入有效的 URL 以使標題成為鏈接。
自動添加段落
該設置自動將段落標籤添加到任何文本中。這使用 WordPress 的wpautop()函數。
應用短代碼
此設置處理文本並應用發現的任何短代碼。
顯示標題
此設置控制小工具標題的可見性。如果取消勾選,將不顯示標題(包括在註冊側欄時定義的before_title和after_title代碼)。
外掛標籤
開發者團隊
原文外掛簡介
DMG Text Widget replaces the standard text widget with one that includes advanced options to apply a CSS class, add paragraphs, apply shortcodes, hide the title and make the title a link.
Two hooks are available to filter the title and text; dmg_text_widget_title for the title and dmg_text_widget_text for the text.
For example, to change the title on a single page or post, you could add this to your functions.php file:
function myTitleFilter( $title )
{
if( is_singular() )
{
return "$title";
}
else
{
return $title;
}
}
add_filter( 'dmg_text_widget_title' , 'myTitleFilter');
More information about this plugin can be found at http://dancoded.com/tag/dmg-text-widget/.
Adding CSS Class(es)
Enter strings, either space or comma separated, which will be applied as CSS classes to the widget wrapper. These classes are sanitized using the sanitize_html_class() function built in to WordPress.
Make the Title a link
Enter a valid URL to make the title a link.
Automatically add paragraphs
This setting automatically adds paragraph tags to any text. This uses the WordPress wpautop() function.
Apply shortcodes
This setting processes the text and applies any shortcodes found.
Show the Title
This setting controls the visibility of the widget title. If unchecked, the title (including the before_title and after_title code defined when registering the sidebar) will not be displayed.
