WordPress.org

Forums

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

  1. David
    Member
    Posted 9 months 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:

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

    Thank you very much in advance!

    https://wordpress.org/plugins/custom-field-suite/

  2. David
    Member
    Posted 9 months 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
    Member
    Plugin Author

    Posted 8 months 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
    Member
    Posted 8 months 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!

Reply

You must log in to post.

About this Plugin

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

About this Topic