Support

Account

Home Forums Front-end Issues Display cust. field value on index.php

Solving

Display cust. field value on index.php

  • Hi, I just need to display value from two fields on homepage / index.php

        <?php while ( have_posts() ) : the_post(); ?>
            <h3 class="name wow fadeInUp"><?php the_field('meno'); ?></h3>
            <blockquote class="wow fadeInUp"><em><?php the_field('recenzia'); ?></em></blockquote>
        <?php endwhile; // end of the loop. ?>

    But the_field() function is not working ๐Ÿ™
    Can anyone help?

  • this is working only on posts not on custom post types.

    how to display acf field on custom post type?

    Thanks

  • Excuse my bad english.
    you should try to call the custom post like that

    <?php

    // get posts
    $posts = get_posts(‘your_post_type’);

    // loop
    if( $posts ) {

    foreach( $posts as $post ) {

    setup_postdata( $post );
    }

    <h3 class=”name wow fadeInUp”><?php the_field(‘meno’); ?></h3>

    <?php the_field(‘recenzia’); ?>

    <?php
    wp_reset_postdata();

    }

    ?>

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.