Support

Account

Home Forums General Issues Cannot display a ACF in Traveler theme

Helping

Cannot display a ACF in Traveler theme

  • I use Traveler 1.1.9.1 on my website.

    I really needed the additional fields for the rental post type (number of rooms, number of bathrooms etc).
    And I installed Advanced Custom fields plugin.
    I created additional fields.

    Did everything by the instruction from this video:

    https://www.youtube.com/watch?v=a5yG7Fnfglg

    But I did not find among the templates of the website content.php

    And tried to input them into
    single-st_rental.php

    But the fields are not seen anywhere.

    Here is the code:

    <?php echo get_field(‘bedrooms_number’); ?>
    <?php echo get_field(‘bathrooms_number’); ?>
    <?php echo get_field(‘pool_length’); ?>
    <?php echo get_field(‘pool_width’); ?>

    Then I tried to use the shortcode

    [acf field="{$bedrooms_number}"]
    [acf field="{$bathrooms_number}"]
    [acf field="{$pool_length}"]
    [acf field="{$pool_width}"]

    But it did not help anyway.

    What am I doing wrong?

  • Hi @leramulina

    I’m sorry.
    We can’t provide help for specific themes. It’s better you contact the theme developers for that.

    What I can tell you is that there’s two things you need to fullfil for get_field() to work:
    1. You need to put it in the right template.
    2. It needs to be inside the loop: https://codex.wordpress.org/The_Loop

    There’s an exception to this. You can display the values from one post anywhere by setting the second parameter of get_field() which in the case of posts/pages would be the post ID: get_field('fieldname', $post->ID)

    There are a bit more to it as well if you display values from something other than a post but you can find all that information in the documentation.

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

The topic ‘Cannot display a ACF in Traveler theme’ is closed to new replies.