I am using a page builder called King composer for wordpress, where i am trying to build some custom functions, like is intended.
My problem is, that the build-in background color picker is base64 encoding the background properties, So i need to decode it - But first i need to decode the 'my-css' json, so that i can access the different properties.
this is the return of what i get from the builder.
array (
'_id' => '69391',
'image' => '294,9,16',
'gallery-text' => 'Dette er nærmest et galleri',
'my-css' => '{
`kc-css`:{
`any`:{
`typography`{`color|`:`#ffffff`},
`background`{`background|`:`longBase64StringHere`},
`box`:{`margin|`:`100px inherit inherit inherit`}
}
}
}',
)
So far i have tried:
$decodedBackground = base64_decode($atts['my-css']);
which returns as null
then i tried :
$decodedJson = json_decode($atts['my-css']);
which returns : null
Also tried some other stuff that went horriably wrong
I don't really understand it, I can access the other properties fine, since it is just a part of an array, but the CSS part, I cannot comprehend. I think I need to go deeper in - but I can't get it to work.
Been stuck for about 1.5 hours now, so any help or pointers would be appreciated
/------ EDIT -----/
So this is how i am trying to inspect the decoded json afterwards - might be important.
$decodedJson = json_decode($atts['my-css'], true);
echo '<pre>' . var_export($decodedJson, true) . '</pre>';