Support

Account

Home Forums Backend Issues (wp-admin) get_field not recognised Reply To: get_field not recognised

  • Sorry – I’ve been having problems explaining it! I’ll do my best to break down what I am trying to do.

    I’ve created a custom field type called testimonials, and set up a multiple choice for the specific colour.

    I have set the custom field type to display on the testimonials rotator section for the plugin.

    When you are in the testimonial rotator, you can choose which colour you want – so this part of the plugin is working fine.

    Within the section that is printing the testimonials on each page – which is in the file loop-testimonial in the actual plugin, I have tried added the code as above, with in mind that it will print the chosen colour. This will then set the css class, which has been set in styling.

    However, what I am getting when I do this is the following code printed:

    <div class=".get_field('header_bullets_and_testimonials_colour');">
    <div class="testimonial_rotator_quote">
    Quote goes here.</div>
    </div>

    The code I am inputting to the loop-testimonials.php file is

    echo "<div class=\".get_field('header_bullets_and_testimonials_colour');\">\n";
    echo "<div class=\"testimonial_rotator_quote\">\n";
    echo ($show_size == "full") ? do_shortcode(nl2br(get_the_content(' '))) : get_the_excerpt();
    echo "</div>\n";
    echo "</div>\n";