logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll

Different header color

22/02/2025, by Anonymous (not verified)
Forums

You need to insert the hex color code found in the field field_color into the appropriate piece of HTML code.

 

I prepared the following in the site template:

<?php print render($title_prefix); ?>
                <?php if ($title): ?>
                    <h1 style="color: #<?php echo $Set_color; ?>;" id="page-title"><?php print $title; ?></h1>
                <?php endif; ?>
                <?php print render($title_suffix); ?>

 

In general, I can't figure out how to insert the content of the $Set_color variable with the value from the field_color field and then naturally pass it into the pre-prepared  <h1 style="color: #<?php echo $Set_color; ?>;" id="page-title"><?php print $title; ?></h1>.

 

I started with this code

  // Loading the node
  $node = node_load($nid);
  // Getting the field values
  $Set_color = $node->field_color[$node->language]['0']['value'];

 

But nothing is being outputted.

 

How can I display the value?