Error in WP Includes > functions.php – json
-
Hi
I am not seeing my child theme styles kick in on Parent TT5. It worked in TT4. Now debugging and in admin dashboard I am getting this error:
Notice: wp_json_file_decode(): Error when decoding a JSON file at path /my-site/wp-content/themes/child-theme/theme.json: Syntax error in /my-site/wp-includes/functions.php on line 6114
The code in this location is (trigger_error is the exact line):
if ( E_USER_ERROR === $error_level ) {
throw new WP_Exception( $message );
}
trigger_error( $message, $error_level );
}What can I do to fix this. I heard it may run from database instead of theme……
Thx
-
Hey, seems like your theme.json has a syntax error.
If you want to you can post the content of it here and I can have a look, or you can try using this online tool to find errors in your json
https://jsoncrack.com/@benniledl You are more than welcome to have a look. What I hear is that it may be pulling styles and more from DB and therefore not seeing the T.J. No one can tell me how to fix this….
I tried the jsoncrack, no errors but at scroll bar there are some color blocks. I do not know what they indicate.
I am defining custom shadows that I use for my buttons. Theme shadows I ported, for the theme never to overwrite my definition of buttons. Also I need these variables for plugin and css overwrite.
Also I just ran the whole thing through Chat, that complains about 6 issues, but when confronting specifically, it turns out that code is correct.
Chat mentioned that I kind of double apply fluid. Could you please comment how to be correct about it.
One thing. Schema reference was 6.6 until 2 min ago. I updated to WP 6.7 a month ago. Please verify if this ref is correct.
Note: everything worked in TT4. Nothing or some works in TT5 and it’s a mystery to me.
Here Goes, let me hear your thoughts:
{
"$schema": "https://schemas.wp.org/wp/6.7/theme.json",
"version": 3,
"settings": {
"typography": {
"dropCap": true,
"fluid": true,
"defaultFontSizes": false,
"fontSizes": [
{
"fluid": {
"min": "0.7rem",
"max": "0.9rem"
},
"name": "Small",
"slug": "small"
},
{
"fluid": {
"min": "0.9rem",
"max": "1.05rem"
},
"name": "Medium",
"slug": "medium"
},
{
"fluid": {
"min": "1.39rem",
"max": "1.85rem"
},
"name": "Large",
"slug": "large"
},
{
"fluid": {
"min": "1.85rem",
"max": "2.5rem"
},
"name": "Extra Large",
"slug": "x-large"
},
{
"fluid": {
"min": "2.5rem",
"max": "3.27rem"
},
"name": "Extra Extra Large",
"slug": "xx-large"
},
{
"fluid": {
"min": "3rem",
"max": "8rem"
},
"name": "3x Extra Large",
"slug": "3x-large"
},
{
"fluid": {
"min": "8rem",
"max": "12rem"
},
"name": "4x Extra Large",
"slug": "4x-large"
}
]
},
"color": {
"palette": [
{
"color": "#f9f9f9",
"name": "Base",
"slug": "base"
},
{
"color": "#ffffff",
"name": "Base / Two",
"slug": "base-2"
},
{
"color": "#111111",
"name": "Contrast",
"slug": "contrast"
},
{
"color": "#636363",
"name": "Contrast / Two",
"slug": "contrast-2"
},
{
"color": "#A4A4A4",
"name": "Contrast / Three",
"slug": "contrast-3"
},
{
"color": "#cfcabe",
"name": "Accent",
"slug": "accent"
},
{
"color": "#c2a990",
"name": "Accent / Two",
"slug": "accent-2"
},
{
"color": "#d8613c",
"name": "Accent / Three",
"slug": "accent-3"
},
{
"color": "#b1c5a4",
"name": "Accent / Four",
"slug": "accent-4"
},
{
"color": "#b5bdbc",
"name": "Accent / Five",
"slug": "accent-5"
},
{
"name": "Black",
"slug": "black",
"color": "#000000"
},
{
"name": "White",
"slug": "white",
"color": "#ffffff"
},
{
"name": "Draupnir / 8",
"slug": "draupnir-8",
"color": "#171717"
},
{
"name": "Draupnir / Shadow",
"slug": "draupnir-shadow",
"color": "#BABECC"
},
{
"name": "Draupnir / Red",
"slug": "draupnir-red",
"color": "#ae1100"
},
{
"name": "Post-It / Yellow",
"slug": "post-it-yellow",
"color": "#f1f58f"
},
{
"name": "Post-It / Orange",
"slug": "post-it-orange",
"color": "#ffa930"
},
{
"name": "Post-It / Pink",
"slug": "post-it-pink",
"color": "#ff32b2"
},
{
"name": "Post-It / Blue",
"slug": "post-it-blue",
"color": "#a9edf1"
},
{
"name": "Post-It / Green",
"slug": "post-it-green",
"color": "#74ed4b"
},
{
"name": "Post-It / Purple",
"slug": "post-it-purple",
"color": "#ba3fff"
}
],
"custom": true
},
"shadow": {
"presets": [
{
"name": "Input Shadow",
"slug": "input-shadow",
"shadow": "inset 2px 2px 5px var(--wp--preset--color--draupnir-shadow), inset -5px -5px 10px var(--wp--preset--color--base-2)"
},
{
"name": "Input Shadow Focus",
"slug": "input-shadow-focus",
"shadow": "inset 1px 1px 2px var(--wp--preset--color--draupnir-shadow), inset -1px -1px 2px var(--wp--preset--color--base-2)"
},
{
"name": "Button Shadow",
"slug": "button-shadow",
"shadow": "-5px -5px 20px var(--wp--preset--color--base-2), 5px 5px 20px var(--wp--preset--color--draupnir-shadow)"
},
{
"name": "Button Shadow Hover",
"slug": "button-shadow-hover",
"shadow": "-2px -2px 5px var(--wp--preset--color--base-2), 2px 2px 5px var(--wp--preset--color--draupnir-shadow)"
},
{
"name": "Button Shadow Focus",
"slug": "button-shadow-focus",
"shadow": "inset 1px 1px 2px var(--wp--preset--color--draupnir-shadow), inset -1px -1px 2px var(--wp--preset--color--base-2)"
}
]
},
},
"styles": {
"elements": {
"input": {
"color": "var(--wp--preset--color--draupnir-shadow)",
"backgroundColor": "var(--wp--preset--color--base)",
"border": "none",
"borderRadius": "32px",
"padding": "16px",
"fontSize": "var(--wp--preset--font-size--medium)",
"shadow": "var(--wp--preset--shadow--input-shadow)",
"focus": {
"outline": "none",
"shadow": "var(--wp--preset--shadow--input-shadow-focus)"
}
},
"textarea": {
"color": "var(--wp--preset--color--draupnir-shadow)",
"backgroundColor": "var(--wp--preset--color--base-2)",
"border": "none",
"borderRadius": "32px",
"padding": "16px",
"fontSize": "var(--wp--preset--font-size--medium)",
"shadow": "var(--wp--preset--shadow--input-shadow)"
},
"button": {
"color": "var(--wp--preset--color--draupnir-red)",
"backgroundColor": "var(--wp--preset--color--base)",
"border": "none",
"borderRadius": "32px",
"padding": "16px",
"fontSize": "var(--wp--preset--font-size--medium)",
"cursor": "pointer",
"shadow": "var(--wp--preset--shadow--button-shadow)",
":hover": {
"shadow": "var(--wp--preset--shadow--button-shadow-hover)"
},
":focus": {
"shadow": "var(--wp--preset--shadow--button-shadow-focus)",
"outline": "none",
"border": "none"
}
}
},
"blocks": {
"core/button": {
"variations": {
"outline": {
"spacing": {
"padding": {
"bottom": "calc(1rem - 1px)",
"left": "calc(1rem - 1px)",
"right": "calc(1rem - 1px)",
"top": "calc(1rem - 1px)"
}
},
"border": "none"
}
},
"elements": {
"button": {
"color": {
"text": "var(--wp--preset--color--draupnir-red)"
},
"fontWeight": "600",
"shadow": "var(--wp--preset--shadow--button-shadow)",
":hover": {
"shadow": "var(--wp--preset--shadow--button-shadow-hover)"
},
":focus": {
"shadow": "var(--wp--preset--shadow--button-shadow-focus)",
"outline": "none",
"border": "none"
},
"transition": "all 0.2s ease-in-out",
"cursor": "pointer"
}
}
},
"core/buttons": {
"spacing": {
"blockGap": "2.7rem"
}
},
"core/search": {
"css": "& .wp-block-search__input{border-radius:.33rem}",
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
},
"elements": {
"button": {
"border": {
"radius": "32px"
}
}
}
}
}
},
"customTemplates": [
{
"name": "svalinn-home",
"title": "Svalinn Art Cover",
"postTypes": [
"page",
]
},
{
"name": "draupnir-hero",
"title": "Draupnir 9 w. Hero Section",
"postTypes": [
"page",
"post",
"product"
]
},
{
"name": "draupnir-404",
"title": "Draupnir 9 404 Missing Page",
"postTypes": [
"page",
]
},
{
"name": "draupnir-coming-soon",
"title": "Draupnir 9 Coming Soon",
"postTypes": [
"page",
"post",
"product"
]
}
],
"templateParts": [
{
"name": "store-layout",
"title": "Vendor Store Layout"
}
]
}At the bottom of code I try to create a template part, which has not gone well. Any advise to accomplish this? It does not show as part. I have store-layout file as both php and html. Not sure what to do.
If you validate the JSON code here: https://jsonlint.com/ you will recognize 3 errors. These are each too many “,”.
With an editor for editing your files that shows you errors directly, this would not happen. The JSONCrack mentioned above is one way, I use phpstorm, it should also be possible with Visual Studio.
Here is the valid json without these 3 “,
{
"$schema": "https://schemas.wp.org/wp/6.7/theme.json",
"version": 3,
"settings": {
"typography": {
"dropCap": true,
"fluid": true,
"defaultFontSizes": false,
"fontSizes": [
{
"fluid": {
"min": "0.7rem",
"max": "0.9rem"
},
"name": "Small",
"slug": "small"
},
{
"fluid": {
"min": "0.9rem",
"max": "1.05rem"
},
"name": "Medium",
"slug": "medium"
},
{
"fluid": {
"min": "1.39rem",
"max": "1.85rem"
},
"name": "Large",
"slug": "large"
},
{
"fluid": {
"min": "1.85rem",
"max": "2.5rem"
},
"name": "Extra Large",
"slug": "x-large"
},
{
"fluid": {
"min": "2.5rem",
"max": "3.27rem"
},
"name": "Extra Extra Large",
"slug": "xx-large"
},
{
"fluid": {
"min": "3rem",
"max": "8rem"
},
"name": "3x Extra Large",
"slug": "3x-large"
},
{
"fluid": {
"min": "8rem",
"max": "12rem"
},
"name": "4x Extra Large",
"slug": "4x-large"
}
]
},
"color": {
"palette": [
{
"color": "#f9f9f9",
"name": "Base",
"slug": "base"
},
{
"color": "#ffffff",
"name": "Base / Two",
"slug": "base-2"
},
{
"color": "#111111",
"name": "Contrast",
"slug": "contrast"
},
{
"color": "#636363",
"name": "Contrast / Two",
"slug": "contrast-2"
},
{
"color": "#A4A4A4",
"name": "Contrast / Three",
"slug": "contrast-3"
},
{
"color": "#cfcabe",
"name": "Accent",
"slug": "accent"
},
{
"color": "#c2a990",
"name": "Accent / Two",
"slug": "accent-2"
},
{
"color": "#d8613c",
"name": "Accent / Three",
"slug": "accent-3"
},
{
"color": "#b1c5a4",
"name": "Accent / Four",
"slug": "accent-4"
},
{
"color": "#b5bdbc",
"name": "Accent / Five",
"slug": "accent-5"
},
{
"name": "Black",
"slug": "black",
"color": "#000000"
},
{
"name": "White",
"slug": "white",
"color": "#ffffff"
},
{
"name": "Draupnir / 8",
"slug": "draupnir-8",
"color": "#171717"
},
{
"name": "Draupnir / Shadow",
"slug": "draupnir-shadow",
"color": "#BABECC"
},
{
"name": "Draupnir / Red",
"slug": "draupnir-red",
"color": "#ae1100"
},
{
"name": "Post-It / Yellow",
"slug": "post-it-yellow",
"color": "#f1f58f"
},
{
"name": "Post-It / Orange",
"slug": "post-it-orange",
"color": "#ffa930"
},
{
"name": "Post-It / Pink",
"slug": "post-it-pink",
"color": "#ff32b2"
},
{
"name": "Post-It / Blue",
"slug": "post-it-blue",
"color": "#a9edf1"
},
{
"name": "Post-It / Green",
"slug": "post-it-green",
"color": "#74ed4b"
},
{
"name": "Post-It / Purple",
"slug": "post-it-purple",
"color": "#ba3fff"
}
],
"custom": true
},
"shadow": {
"presets": [
{
"name": "Input Shadow",
"slug": "input-shadow",
"shadow": "inset 2px 2px 5px var(--wp--preset--color--draupnir-shadow), inset -5px -5px 10px var(--wp--preset--color--base-2)"
},
{
"name": "Input Shadow Focus",
"slug": "input-shadow-focus",
"shadow": "inset 1px 1px 2px var(--wp--preset--color--draupnir-shadow), inset -1px -1px 2px var(--wp--preset--color--base-2)"
},
{
"name": "Button Shadow",
"slug": "button-shadow",
"shadow": "-5px -5px 20px var(--wp--preset--color--base-2), 5px 5px 20px var(--wp--preset--color--draupnir-shadow)"
},
{
"name": "Button Shadow Hover",
"slug": "button-shadow-hover",
"shadow": "-2px -2px 5px var(--wp--preset--color--base-2), 2px 2px 5px var(--wp--preset--color--draupnir-shadow)"
},
{
"name": "Button Shadow Focus",
"slug": "button-shadow-focus",
"shadow": "inset 1px 1px 2px var(--wp--preset--color--draupnir-shadow), inset -1px -1px 2px var(--wp--preset--color--base-2)"
}
]
},
},
"styles": {
"elements": {
"input": {
"color": "var(--wp--preset--color--draupnir-shadow)",
"backgroundColor": "var(--wp--preset--color--base)",
"border": "none",
"borderRadius": "32px",
"padding": "16px",
"fontSize": "var(--wp--preset--font-size--medium)",
"shadow": "var(--wp--preset--shadow--input-shadow)",
"focus": {
"outline": "none",
"shadow": "var(--wp--preset--shadow--input-shadow-focus)"
}
},
"textarea": {
"color": "var(--wp--preset--color--draupnir-shadow)",
"backgroundColor": "var(--wp--preset--color--base-2)",
"border": "none",
"borderRadius": "32px",
"padding": "16px",
"fontSize": "var(--wp--preset--font-size--medium)",
"shadow": "var(--wp--preset--shadow--input-shadow)"
},
"button": {
"color": "var(--wp--preset--color--draupnir-red)",
"backgroundColor": "var(--wp--preset--color--base)",
"border": "none",
"borderRadius": "32px",
"padding": "16px",
"fontSize": "var(--wp--preset--font-size--medium)",
"cursor": "pointer",
"shadow": "var(--wp--preset--shadow--button-shadow)",
":hover": {
"shadow": "var(--wp--preset--shadow--button-shadow-hover)"
},
":focus": {
"shadow": "var(--wp--preset--shadow--button-shadow-focus)",
"outline": "none",
"border": "none"
}
}
},
"blocks": {
"core/button": {
"variations": {
"outline": {
"spacing": {
"padding": {
"bottom": "calc(1rem - 1px)",
"left": "calc(1rem - 1px)",
"right": "calc(1rem - 1px)",
"top": "calc(1rem - 1px)"
}
},
"border": "none"
}
},
"elements": {
"button": {
"color": {
"text": "var(--wp--preset--color--draupnir-red)"
},
"fontWeight": "600",
"shadow": "var(--wp--preset--shadow--button-shadow)",
":hover": {
"shadow": "var(--wp--preset--shadow--button-shadow-hover)"
},
":focus": {
"shadow": "var(--wp--preset--shadow--button-shadow-focus)",
"outline": "none",
"border": "none"
},
"transition": "all 0.2s ease-in-out",
"cursor": "pointer"
}
}
},
"core/buttons": {
"spacing": {
"blockGap": "2.7rem"
}
},
"core/search": {
"css": "& .wp-block-search__input{border-radius:.33rem}",
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
},
"elements": {
"button": {
"border": {
"radius": "32px"
}
}
}
}
}
},
"customTemplates": [
{
"name": "svalinn-home",
"title": "Svalinn Art Cover",
"postTypes": [
"page",
]
},
{
"name": "draupnir-hero",
"title": "Draupnir 9 w. Hero Section",
"postTypes": [
"page",
"post",
"product"
]
},
{
"name": "draupnir-404",
"title": "Draupnir 9 404 Missing Page",
"postTypes": [
"page",
]
},
{
"name": "draupnir-coming-soon",
"title": "Draupnir 9 Coming Soon",
"postTypes": [
"page",
"post",
"product"
]
}
],
"templateParts": [
{
"name": "store-layout",
"title": "Vendor Store Layout"
}
]
}@threadi Good link I am using VSC. The primary reason for creating a child theme, Thx. I do not see error correction, but still new to it, so maybe I missed a setting….
@benniledl Thank you. It’s appreciated.
Styles are still not kicking in. Colors are not in editor and I see 2 different stylings as admin vs. not signed in. Cache is purged many times. I trust enqeueus are triggered correct and also in right order. So more specifically, is T.J. correct for showing my colors and font sizes in editor setting?
The topic ‘Error in WP Includes > functions.php – json’ is closed to new replies.