首页 视频课程 WordPress开发文档文章格式类型与评论 自带功能

自带功能

2020-04-21 / 5257阅

本视频需要登录以后才能播放

登录

WordPress有一些自带的功能,默认是没有开启的。

我们在制作主题时可以手动开启这些功能

add_action('after_setup_theme', 'theme_slug_setup');//当这个主题安装以后就执行
function theme_slug_setup()
{
       add_theme_support('post-thumbnails'); //开启特色图片
       add_theme_support('html5'); //让你的评论和搜索表单支持HTML5
       add_theme_support('post-formats');//开启文章格式
       add_theme_support('custom-logo');//开启LOGO
       add_theme_support('custom-header-uploads');//顶部图片和颜色
       add_theme_support('custom-header');//开启颜色和顶部图像
       add_theme_support('custom-background');//开启网页背景 body_class
       add_theme_support('title-tag');//wp_head函数输出标题
} 

特色图片和HTML5标签开启就能用,网页背景图片需要确保在body标签中使用了 body_class函数。

title_tag是避免标题标签重复的一种解决方案。

阅读文章或者观看视频过程中有任何问题,请下方留言或者联系我Q248758228

大家谈论
    我的见解
    目录