Support

Account

Home Forums General Issues get_field on Page

Unread

get_field on Page

  • Hi to all!

    My theme use this code:
    <?php echo $this->get_excerpt($excerpt_length);?>

    I replace it with:
    <?php
    $url = ‘https://’ . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];
    if(strpos($url, ‘en/’) == true && get_field(‘translation’) == ‘yes’ && get_field(‘excerpt-english’) != ”) {
    echo ‘<span class=”no_translate”>’;
    echo $excerpt = wp_trim_words( get_field(‘excerpt-english’), $num_words = 25, $more = ‘…’);
    echo ‘</span>’;
    } else {
    echo $this->get_excerpt($excerpt_length);
    }
    ?>

    No problem for the post list of category. The problem is on the Front Page (Home), I can’t get fields data because ACF do not refer to post ID in loop but to Page ID (Home).

    How do I solve?

Viewing 1 post (of 1 total)

The topic ‘get_field on Page’ is closed to new replies.