Hello,
I'm trying to get the MB color picker value from the current post, not from a settings page.
This is what I have and works well, but it has a specific post ID (281). How can I pull the current post ID instead of having a fix value?
add_action( 'wp_head', function () { ?>
<style>
:root {
/*Begin First Varible Code*/
--primary-1: <?php
$primary_color_1 = rwmb_meta( 'primary_hero_bg_color_1', '', 281 );
echo $primary_color_1;
?>;
;
/*End First Varible Code*/
/*Begin Second Varible Code*/
--secondary-1: <?php
$secondary_color_1 = rwmb_meta( 'secondary_hero_bg_color_1', '', 281 );
echo $secondary_color_1;
?>;
;
/*End Second Varible Code*/
}
</style>
<?php } );
I tried rwmb_meta( 'primary_hero_bg_color_1 );
expecting to get the value from the current post but it didn't work.
Thanks in advance for your help.