Support

Account

Home Forums General Issues Color Picker check for value

Solved

Color Picker check for value

  • Hi.
    I’m using the following code inside <head>, knowing that theres a style.css loaded.

    <?php
    	$cssstyle = get_field ('bm_fundo_cor');
    	if ( $cssstyle != "" ) {
    ?>
    	<style type="text/css">
    		body {
    		    background-color: <?php the_field( $cssstyle ); ?> !important;
    		}
    	</style>
    <?php } ?>

    Why the $cssstyle doesn’t work when called at the_field?
    Thank you.

  • because $cssstyle = a color value and not a field name

    
    <?php
    	$cssstyle = get_field ('bm_fundo_cor');
    	if ( $cssstyle != "" ) {
    ?>
    	<style type="text/css">
    		body {
    		    background-color: <?php echo $cssstyle; ?> !important;
    		}
    	</style>
    <?php } ?>
    
  • Thank you for your kind help 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Color Picker check for value’ is closed to new replies.