Home › Forums › Front-end Issues › Append Inline SVG to Menu item › Reply To: Append Inline SVG to Menu item
Hi @liqid,
What does ‘social_icon_static’ return?
If you hard code that line (so do away with the get_field part), does it still display outside the tag? If not, then it’s how the include is working.
I’m sure I had similar once before with something. If you declare the get_field above, then include the $var, does that work:
if ( $depth == 0 ) {
$social_icon_static = get_field('social_icon_static', $item);
$item_output .= '<div class="uk-inline-clip uk-transition-toggle uk-animation-toggle social-icon-container" tabindex="0">
<svg class="uk-animation-slide-top uk-animation-reverse social-top" width="16px" height="16px"> '. get_template_part( 'assets/images/svg/inline', $social_icon_static) .' </svg>
<svg class="uk-transition-slide-bottom social-bottom" width="16px" height="16px"> '. get_template_part( 'assets/images/svg/inline', get_field('social_icon_hover', $item)) .' </svg>
</div>';
}
If hard coding still blows it out, then it must be non ACF related. Sometimes, using the browser inspect tool can help as you can play about with it, then adjust the code accordingly.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.