_strip_template_file_suffix

函式
_strip_template_file_suffix ( $template_file )
Access
Private
引數
  • (string) $template_file Template file name.
    Required:
返回值
  • (string) Template file name without extension.
定義位置
相關方法
_get_block_templates_fileswp_scripts_get_suffix_get_block_template_fileget_theme_file_uriget_template_directory_uri
引入
5.8.0
棄用
-

_strip_template_file_suffix: 這個函式用來從模板的檔名中刪除字尾。這個字尾通常被新增到模板檔名的末尾,以表明模板的型別(例如,頁面、單個文章等): 這個函式用來檢索沒有這個字尾的模板名稱,這在註冊自定義模板時很有用。

從模板檔名中刪除.php或.html字尾。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _strip_template_file_suffix( $template_file ) {
return preg_replace( '/.(php|html)$/', '', $template_file );
}
function _strip_template_file_suffix( $template_file ) { return preg_replace( '/.(php|html)$/', '', $template_file ); }
function _strip_template_file_suffix( $template_file ) {
	return preg_replace( '/.(php|html)$/', '', $template_file );
}

常見問題

FAQs
檢視更多 >