WordPress主题额外CSS的实现
在数据表wp_options中看到
optinon_id:  114
option_name: theme_mods_twentytwenty
option_value:
a:20:{s:18:"custom_css_post_id";i:163;s:16:"sidebars_widgets";a:2:{s:4:"time";i:1576923935;s:4:"data";a:3:{s:19:"wp_inactive_widgets";a:0:{}s:9:"sidebar-1";a:1:{i
option_value是序列化后的值,
⽤函数查询 option_name: theme_mods_twentytwenty的值
<?php
echo "<pre>";
var_dump(get_option('theme_mods_twentytwenty'));
>
array(20) {
["custom_css_post_id"]=>
int(163)
["sidebars_widgets"]=>
array(2) {
["time"]=>
int(1576923935)
["data"]=>
array(3) {
["wp_inactive_widgets"]=>
array(0) {
}
["sidebar-1"]=>
array(1) {
[0]=>
string(6) "text-4"
}
["sidebar-2"]=>
array(1) {
[0]=>
string(6) "text-5"
}
}
}
["nav_menu_locations"]=>
array(1) {
["primary"]=>
int(2)
}
["background_color"]=>
string(6) "ffd699"
["accent_hue_active"]=>
string(7) "default"
["accent_hue"]=>
int(344)
["accent_accessible_colors"]=>
array(2) {
["content"]=>
array(5) {
["text"]=>
["text"]=>
string(7) "#000000"
["accent"]=>
string(7) "#c2093a"
["background"]=>
string(7) "#ffd699"
["borders"]=>
string(7) "#fdad34"
["secondary"]=>
string(7) "#5f461f"
}
wordpress主题怎么安装["header-footer"]=>
array(5) {
["text"]=>
string(7) "#000000"
["accent"]=>
string(7) "#9c1035"
["background"]=>
string(7) "#81d742"
["borders"]=>
string(7) "#64b629"
["secondary"]=>
string(7) "#2d4020"
}
}
["header_footer_background_color"]=>
string(7) "#81d742"
["enable_header_search"]=>
bool(true)
["show_author_bio"]=>
bool(true)
["blog_content"]=>
string(4) "full"
["cover_template_overlay_background_color"]=>
string(7) "#1e73be"
["cover_template_overlay_text_color"]=>
string(7) "#dd3333"
["cover_template_overlay_opacity"]=>
int(0)
["custom_logo"]=>
int(157)
["background_image"]=>
string(48) "wp/wp-content/uploads/2020/01/bg2.jpg"  ["background_preset"]=>
string(3) "fit"
["background_size"]=>
string(7) "contain"
["background_repeat"]=>
string(9) "no-repeat"
["background_attachment"]=>
string(5) "fixed"
}
["custom_css_post_id"]=>int(163)
在wp_post 中看到 id=163
id:163
post_content:body{color:red;}
post_title:twentytwenty
post_type:custom_css
可见它把css设置存在了wp_post中

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。