Link to home
Start Free TrialLog in
Avatar of Andy6350
Andy6350

asked on

Displaying custom field color picker value in inline style

Hi,
I have setup a custom color picker field called "title_colour" which i have placed inline style on a <h2> tag, however its not displaying the hex value on the front end. This is the code im using:

<h3 style="color:<?php the_field('title_colour');?>">Notice Board</h3>

This is the results showing when i inspect the element:

<h3 style="colour:">Notice Board</h3>

This is the link i got the code from

http://www.advancedcustomfields.com/resources/color-picker/

Is there something im doing wrong?

Thanks,
Andrew
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

you need to tell PHP to push out that string to output with the echo command -

<h3 style="color:<?php echo the_field('title_colour');?>">Notice Board</h3>

and there must be a string in the-  the_field('title_colour');
Avatar of Andy6350
Andy6350

ASKER

I have changed the code using the echo command above but it still doesn't appear. There are no specific options in ACF color picker so im assuming its generating a hex string ie #ffffff

Is there any other code i need to include?

Thanks,
Andrew
?????
I have never used the AFC color picker, so I can not say what to do, sorry, but I looked and could not find The developers API for this AFC color picker. I did find this for code examples, but it's useless to me? -
http://www.advancedcustomfields.com/resources/code-examples/
ASKER CERTIFIED SOLUTION
Avatar of Andy6350
Andy6350

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Figured it out myself