Hello. this is about generate block, but I got no solution there.
I want to make a current color on button according to url.
Currently, there is no feature for this.
However, I thought there could be a way to change the color.
add_action( 'init', 'if_url_contains_string' );
function if_url_contains_string() {
$url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if ( false !== strpos( $url, '/shop' ) ) {
echo '<style type="text/css">
.gb-container-ffa8ce99 { background-color: red }
</style>';
} else (false !== strpos( $url, '/product-category/모자') ) {
echo '<style type="text/css">
.gb-container-652ad9ca { background-color: red }
</style>';
} else (false !== strpos( $url, 'product-category/상의') ) {
echo '<style type="text/css">
.gb-container-5cdc6557 { background-color: red }
</style>';
} else (false !== strpos( $url, '/product-category/신발') ) {
echo '<style type="text/css">
.gb-container-64ee13dc { background-color: red }
</style>';
}
}
Unfortunately this doesn’t work..
If this is something complicated and out of scope of support, it is ok not to answer!
I can try to figure out slowly alone.