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";
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.