_post_format_get_term

函式
_post_format_get_term ( $term )
Access
Private
引數
  • (object) $term
    Required:
返回值
  • (object)
定義位置
相關方法
_post_format_get_terms_post_format_wp_get_object_termspost_format_meta_boxget_post_format_string_post_format_link
引入
3.1.0
棄用
-

_post_format_get_term: 這個函式是用來獲取一個特定的文章格式的術語物件。它需要兩個引數,$post_id和$format,它們分別是文章的ID和文章格式的slug: 當你想獲得特定文章格式的術語物件時,經常使用這個函式。

從get_term()建立的術語物件的name屬性中刪除post格式字首。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _post_format_get_term( $term ) {
if ( isset( $term->slug ) ) {
$term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
}
return $term;
}
function _post_format_get_term( $term ) { if ( isset( $term->slug ) ) { $term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); } return $term; }
function _post_format_get_term( $term ) {
	if ( isset( $term->slug ) ) {
		$term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
	}
	return $term;
}

常見問題

FAQs
檢視更多 >