wp_mediaelement_fallback

函式
wp_mediaelement_fallback ( $url )
引數
  • (string) $url The media element URL.
    Required:
返回值
  • (string) Fallback HTML.
定義位置
相關方法
wp_rel_callbackwp_targeted_link_rel_callbackwp_rel_nofollow_callbackwp_delete_linkwp_delete_file
引入
3.6.0
棄用
-

wp_mediaelement_fallback: 當瀏覽器不支援WordPress使用的MediaElement.js播放器時,這個函式返回後備媒體播放器的HTML標記。它被用來為使用者在所有的瀏覽器和裝置上提供一個一致的體驗。

為音訊/視訊提供一個No-JS Flash的後備方案,作為最後的手段。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_mediaelement_fallback( $url ) {
/**
* Filters the Mediaelement fallback output for no-JS.
*
* @since 3.6.0
*
* @param string $output Fallback output for no-JS.
* @param string $url Media file URL.
*/
return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
}
function wp_mediaelement_fallback( $url ) { /** * Filters the Mediaelement fallback output for no-JS. * * @since 3.6.0 * * @param string $output Fallback output for no-JS. * @param string $url Media file URL. */ return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url ); }
function wp_mediaelement_fallback( $url ) {
	/**
	 * Filters the Mediaelement fallback output for no-JS.
	 *
	 * @since 3.6.0
	 *
	 * @param string $output Fallback output for no-JS.
	 * @param string $url    Media file URL.
	 */
	return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
}

常見問題

FAQs
檢視更多 >