Support

Account

Home Forums General Issues Dynamic shortcode from ACF field and CPT

Unread

Dynamic shortcode from ACF field and CPT

  • Hey,

    Is it possible to generate a shortcode from an ACF field from a CPT?

    This is the code that is already used elsewhere and works fine:

    <?php
    $contact_post = get_field('ansprechpartner');
    if ($contact_post): ?>
    <p class="contact-name"><?php echo esc_html($contact_post->post_title); ?></p>
    <p class="contact-position"><?php the_field('position', $contact_post->ID)?></p>
    <p class="contact-telefon"><?php the_field('telefon', $contact_post->ID)?></p>
    <a class="ct-link-button contact-email-link btn--s btn--primary text--base-ultra-light rounded--m" href="mailto:<?php the_field('e-mail', $contact_post->ID)?>">write email</a>
    <?php endif;?>

    Can the field “e-mail” be dynamically transferred into a shortcode?

    Cheers
    Mario

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.