Support

Account

Home Forums ACF PRO get_field on Page

Solving

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 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.