• PODxt

    (@podxt)


    Hi, I’m trying to add captions, alt text and description on images (actually a slideshow). I can add the image title with:

    <h1><?php the_title(); ?></h1>

    But how to do so for the captions, alt text and description fields?
    Here’s a relevant sample of the rest of the code if it can help:

    <div class="slide">
    
        <?php if ( get_post_meta( $post->ID, "slide_url_value", $single = true ) != "" ): ?>
        <a
        href="<?php echo get_post_meta( $post->ID, " slide_url_value ", $single = true ); ?>"
        title="<?php the_title(); ?>">
            <?php the_post_thumbnail( 'featured-slide', array( 'title' => get_the_title() ) ); ?>
        </a>
    
        <?php else: ?>
        <?php the_post_thumbnail( 'featured-slide', array( 'title'=>get_the_title() ) ); ?>
        <?php endif; ?>
            <h1><?php the_title(); ?></h1>
    
    </div>

    Maybe using <?php the_field(''); ?> with id slugs??
    Thanks

  • The topic ‘How to add an image caption / alt text or description with php?’ is closed to new replies.