-2

I am trying to insert a dynamic php value into a html style tag, I am not sure if i am doing the correct way?

<div class="status" style='background: <?php get_option("myoption_background_color") ?>'>
HamZa
  • 14,671
  • 11
  • 54
  • 75
max li
  • 2,417
  • 4
  • 30
  • 44

2 Answers2

5

You forgot the semicolon and echo, check this:

<div class="status" style="background: <?php echo get_option("myoption_background_color"); ?>">
HamZa
  • 14,671
  • 11
  • 54
  • 75
1

Most likely you also need echo:

<div class="status" style="background: <?php echo get_option("myoption_background_color"); ?>">

If a function is called getSomething then it likely returns the value, but not writes it to output.

dfsq
  • 191,768
  • 25
  • 236
  • 258