0

How are you?

My problem is the following on my front page I'm displaying some cards, for example name and description, this information is from my taxonomy called event because I created some fields with ACF and I would like to print them inside the card but I don't know how to do it .

Below I'm putting the code on how I'm printing the cards

    <?php if(is_front_page()):
    $terms = get_terms(
        [
            'taxonomy'   => 'evento',
            'hide_empty' => false,
        ]
    );
    if (!empty( $terms ) && is_array( $terms ) ):
        foreach ( $terms as $term ): ?>

            <div class="col-lg-3 mb-5">
                <div class="card">
                    <img src="..." class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title"><?php echo $term->name; ?></h5>
                        <ul>
                            <li class="card-text">Date:</li>
                            <li class="card-text">Horário: </li>
                            <li class="card-text"></li>
                        </ul>
                        <a href="<?php echo esc_url( get_term_link( $term ) ) ?>" class="btn btn-primary" title="<?php the_title_attribute( 'before=Saiba mais: "&after="' ); ?>">Saiba mais</a>
                    </div>
                </div>
            </div>
        <?php endforeach;
    endif;
?>

<?php else:?>
    <p><?php _e('xxxxxx'); ?></p>
<?php endif;?>

I need to print the values initial_date and end_date Does anyone have any idea how to do this?

1
  • 1
    Hello Rodrigo - Welcome to the WordPress Development community! Unfortunately, questions regarding third-party products are presently off-topic here. The best course of action would be to pose this question in ACF's official support channels (or an associated community). I believe this information is also covered in ACF's Getting Started guides - for tax term meta specifically, the get_field()/the_field() documentation will detail how to retrieve field data attached to terms.
    – bosco
    Aug 3 at 18:34
0

Can you not do something like this?

$initDate = get_field('initial_date',$term);
echo $initDate;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.