I’m trying to have a different icon (inline svg icon) for each item on a menu. I’ve added a Field Type Select to the menu. I go to the menu, and make use of this feature. So far so good. My doubts start here.
I’ve tried this
https://www.advancedcustomfields.com/resources/adding-fields-menu-items/
but I’m only able to add the string returned from Field Type Select
Is it possible to use something like get_template_part(‘SVG/icon’, $iconID) to get the SVG as an inline element?
Thank you!
If you return the icon selection as a URL and you’re wanting to spit out the full SVG code inline, you can use:
<?php echo file_get_contents('URL OF ICON HERE'); ?>