wp_embed_excerpt_more

函式
wp_embed_excerpt_more ( $more_string )
引數
  • (string) $more_string Default 'more' string.
    Required:
返回值
  • (string) 'Continue reading' link prepended with an ellipsis.
定義位置
相關方法
wp_embed_excerpt_attachment_wp_oembed_get_objectwp_trim_excerptwp_html_excerptwp_oembed_get
引入
4.4.0
棄用
-

wp_embed_excerpt_more: 這個函式用來過濾出現在嵌入式文章摘錄中的”閱讀更多”連結。預設情況下,這個連結的內容是”繼續閱讀→”,但這個函式允許開發者自定義連結中出現的文字。

過濾修剪過的摘錄後顯示的’更多’連結中的字串。

在嵌入模板中用省略號和””繼續閱讀””連結取代'[…]’(附加到自動生成的摘錄)。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_embed_excerpt_more( $more_string ) {
if ( ! is_embed() ) {
return $more_string;
}
$link = sprintf(
'<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
esc_url( get_permalink() ),
/* translators: %s: Post title. */
sprintf( __( 'Continue reading %s' ), '<span class="screen-reader-text">' . get_the_title() . '</span>' )
);
return ' &hellip; ' . $link;
}
function wp_embed_excerpt_more( $more_string ) { if ( ! is_embed() ) { return $more_string; } $link = sprintf( '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>', esc_url( get_permalink() ), /* translators: %s: Post title. */ sprintf( __( 'Continue reading %s' ), '<span class="screen-reader-text">' . get_the_title() . '</span>' ) ); return ' &hellip; ' . $link; }
function wp_embed_excerpt_more( $more_string ) {
	if ( ! is_embed() ) {
		return $more_string;
	}

	$link = sprintf(
		'<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
		esc_url( get_permalink() ),
		/* translators: %s: Post title. */
		sprintf( __( 'Continue reading %s' ), '<span class="screen-reader-text">' . get_the_title() . '</span>' )
	);
	return ' &hellip; ' . $link;
}

常見問題

FAQs
檢視更多 >