0

Ive searched and can't find an answer. I have two groups of fonts - one regular fonts and one google fonts. Im using a select dropdown list with two optgroups, one for each group of fonts. What Im trying to accomplish is to load the script for google fonts on the front-end only if a font is selected under that optgroup label. Im able to get the value of the font-family selected in the option, but not the optgroup. I'll attach a screenshot of the dropdown in the admin area.

enter image description here

3
  • When you get_options, is the value output as expected? – simongcc Apr 14 '20 at 6:50
  • optgroups are not stored anywhere. There's no way to know which group a selection belongs to. You'll need to keep a list of which selections are Google Fonts and load the script based on hat. – Jacob Peattie Apr 14 '20 at 8:04
  • Im not sure how get_options would be output on a front-end side file...would you mind explaining. And I dont think a list of each font-family being used is a reasonable solution as there will be more added. – captainM Apr 14 '20 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.