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' ) );}
插件的html输出一般都是符合html5标准的;此外,就是主题对html5的支持了,这个需要自行修改,没有什么便捷的方法。
更多wordpress技术文章,请访问wordpress教程栏目!
以上就是wordpress可以用html5吗的详细内容。