Support

Account

Home Forums ACF PRO Can't get link field in taxonomy-studio.php

Solved

Can't get link field in taxonomy-studio.php

  • I’m trying to use this code from documentation and tweak it a bit.
    but in taxonomy-studio.php not showing.

    I’m trying inspect in chorme code not showing.

    <?php 
        $link = get_field('website');
        if( $link ): 
            $link_url = $link['url'];
            ?>
            <a class="button" href="<?php echo esc_url( $link_url ); ?>" >
                <span>
                    <i class="si-globe">website</i>
                </span>
            </a>
    <?php endif; ?>
  • Is the value saved properly? What does print_r(get_field('website')); return?

  • this code is working.
    Thanks.

    
                <?php 
                $term = get_queried_object();
                $website = get_field('website', $term);
                ?>
                <?php if( $website ): ?>
                <a target="_blank" href="<?php echo $website['url']; ?>"><span><i class="si-globe"></i></span></a>
                <?php endif; ?>
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.