內容簡介
WordPress外掛介紹: 分頁描述
- 分頁描述允許你在WordPress文章中插入分頁和前/後描述,這些值用於分頁。
- 跟"分頁拆分"區塊區別解開,否則會造成註解不對齊。
如何運作:
- 通過使用過濾鉤子,可以為CSS鏈接定義自定義的URL。
- 默認的CSS路徑是:/pagebreak-description/css/custom.css。
- 通過在wp-content/uploads目錄中添加mydesign.css,可以替換默認CSS。
- 如果網站使用SSL加密,URL中的"http"將被替換為"https"。
- 最終的URL是基於wp-upload-dir和mydesign.css的組合。
問題與答案:
- 這個外掛的目的是什麼?
- 允許在WordPress文章中添加分頁和前/後描述。
- 當遇到其他分頁相關的插件時,如何避免混淆使用?
- 不要將"分頁拆分"區塊和"分頁描述"區塊混合使用,以免註解不對齊。
- 如何自定義分頁描述的CSS鏈接URL?
- 使用過濾鉤子"pagebreak_description_css",並返回所需的URL。
- 默認的CSS路徑是什麼?
- 默認CSS路徑是/pagebreak-description/css/custom.css。
- 如果想要使用自己的CSS文件,應該將它放在哪個目錄?
- 將自己的CSS文件放在wp-content/uploads目錄中。
- 如果網站使用SSL加密,URL中的"http"會如何處理?
- URL中的"http"將被替換為"https"。
- 如何獲取最終的CSS鏈接URL?
- 使用wp-upload-dir和mydesign.css的組合,形成最終的URL。
外掛標籤
開發者團隊
原文外掛簡介
Enter page breaks and before/after descriptions. Values are used in pagination.
Do not mix this block with the Page Break block, as it may cause the comment to be misaligned.
How it works
Filter hooks
/** ==================================================
* Filter for CSS URL.
* Default CSS -> /pagebreak-description/css/style.css
*/
add_filter(
'pagebreak_description_css',
function() {
/* If you put mydesign.css in wp-content/uploads */
$wp_uploads = wp_upload_dir();
$upload_url = $wp_uploads['baseurl'];
if ( is_ssl() ) {
$upload_url = str_replace( 'http:', 'https:', $upload_url );
}
$upload_url = untrailingslashit( $upload_url );
$url = $upload_url . '/mydesign.css';
return $url;
},
10,
1
);
