Custom Field Suite
[resolved] Adding "alt" tag to CFS images in and outside the loop - Metadata (4 posts)

  1. David
    Posted 1 year ago #

    Hey guys,

    i am still not able to add the alt tag to a custom field (both: normal and in the loop) image. I this could find its way in an update :)

    This is my code:

    $fields = $cfs->get('bilder_maintenance');
    foreach ($fields as $field) { ?>
    <img src="<?php echo $field['bild_maintenance']; ?>" alt="??????">
    <?php echo $field['description']; ?>
    <?php endif; ?>
    <?php } ?>

    Thank you very much in advance!


  2. David
    Posted 1 year ago #

    For sure i could easily add further custom fields for that as a workaround, but i hope there is a more user-friendly method.

  3. Matt Gibbs
    Plugin Author

    Posted 1 year ago #

    Adding a new "alt tag" text field would be your best bet. Alternatively, you could use the File field type, then just use WP's native Alt Text / Description boxes for the attachment itself.

  4. David
    Posted 1 year ago #

    Hey mgibbs189,

    thank you for your answer! Do you, or does anyone else know, how to get the WP's alt text or description in combination with a custom field loop?

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Field Suite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic