render_block_core_term_description

函式
render_block_core_term_description ( $attributes )
引數
  • (array) $attributes Block attributes.
    Required:
返回值
  • (string) Returns the description of the current taxonomy term, if available
定義位置
相關方法
register_block_core_term_descriptionrender_block_core_query_paginationrender_block_core_patternrender_block_core_site_taglinerender_block_core_post_terms
引入
-
棄用
-

render_block_core_term_description: 這是一個核心WordPress函式,用於在編輯器中渲染術語描述塊。它被用來在網站的前端輸出該塊的HTML標記。

在伺服器上渲染`core/term-description’區塊。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function render_block_core_term_description( $attributes ) {
$term_description = '';
if ( is_category() || is_tag() || is_tax() ) {
$term_description = term_description();
}
if ( empty( $term_description ) ) {
return '';
}
$extra_attributes = ( isset( $attributes['textAlign'] ) )
? array( 'class' => 'has-text-align-' . $attributes['textAlign'] )
: array();
$wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );
return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
}
function render_block_core_term_description( $attributes ) { $term_description = ''; if ( is_category() || is_tag() || is_tax() ) { $term_description = term_description(); } if ( empty( $term_description ) ) { return ''; } $extra_attributes = ( isset( $attributes['textAlign'] ) ) ? array( 'class' => 'has-text-align-' . $attributes['textAlign'] ) : array(); $wrapper_attributes = get_block_wrapper_attributes( $extra_attributes ); return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>'; }
function render_block_core_term_description( $attributes ) {
	$term_description = '';

	if ( is_category() || is_tag() || is_tax() ) {
		$term_description = term_description();
	}

	if ( empty( $term_description ) ) {
		return '';
	}

	$extra_attributes   = ( isset( $attributes['textAlign'] ) )
		? array( 'class' => 'has-text-align-' . $attributes['textAlign'] )
		: array();
	$wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );

	return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
}

常見問題

FAQs
檢視更多 >