Call custom field into menu item

This is what i have used for checking to see if the custom field is there or not. I am sure you can use it as well.

<?php 
    $custom_field = get_post_meta($post->ID, 'Your Custom Field Name', true);

    // Checks to see if there is a value in the custom field
    if($custom_field != '') { echo $custom_field; }
?>

It probably would look something like this with your code above:

<ul>
   <li><span class="icon" style="background-image:url(<?php 
    $custom_field = get_post_meta($post->ID, 'Your Custom Field Name', true);

    // Checks to see if there is a value in the custom field
    if($custom_field != '') { echo $custom_field; }
?>);">   </span><a href="https://wordpress.stackexchange.com/questions/73316/link">link</a></li>
</ul>

Leave a Comment