Products
GG网络技术分享 2025-03-18 16:09 0
wordpress可以用html5吗
wordpress是可以用html5的,可以为WordPress开启 HTML5 支持。WordPress 也可以通过在 header.php 文件添加这段代码的方法实现。或者使用 functions.php 文件也可以:
找到当前主题对应的 functions.php 文件,并添加如下代码:
function add_ie_html5_shim () {echo '';
}
add_action('wp_head', 'add_ie_html5_shim');
原理是通过 header.php 文件中的 wp_head() 函数强行插入。
wordpress调用html5文件就WP核心来说,只需要在下面的HOOK
after_setup_theme
的函数内添加如下代码:
/** Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
如果没有找到挂到上面HOOK的函数,需要在functions.php中添加:
add_action( 'after_setup_theme', 'suoling_net_after_theme_setup' );
function suoling_net_after_theme_setup(){
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
}
Demand feedback