wp_make_content_images_responsive

函式
wp_make_content_images_responsive ( $content )
引數
  • (string) $content The raw post content to be filtered.
    Required:
返回值
  • (string) Converted content with 'srcset' and 'sizes' attributes added to images.
相關
  • wp_image_add_srcset_and_sizes()
定義位置
相關方法
_wp_ajax_delete_comment_responsewp_update_image_subsizeswp_create_image_subsizeswp_ajax_media_create_image_subsizeswp_get_attachment_image_sizes
引入
4.4.0
棄用
5.5.0

wp_make_content_images_responsive: 這是一個用於使WordPress網站內容中的影象具有響應性的功能。它為內容中的圖片標籤新增響應的CSS類,這樣它們就會被縮小以適應小螢幕。

過濾文章內容中的’img’元素,新增’srcset’和’size’屬性。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_make_content_images_responsive( $content ) {
_deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' );
// This will also add the `loading` attribute to `img` tags, if enabled.
return wp_filter_content_tags( $content );
}
function wp_make_content_images_responsive( $content ) { _deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' ); // This will also add the `loading` attribute to `img` tags, if enabled. return wp_filter_content_tags( $content ); }
function wp_make_content_images_responsive( $content ) {
	_deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' );

	// This will also add the `loading` attribute to `img` tags, if enabled.
	return wp_filter_content_tags( $content );
}

常見問題

FAQs
檢視更多 >